MyMark: an introduction

MyMark can mimic Markdown, and any notation you define.

MyMark is a plain-text markup language in the spirit of Markdown: text that reads well as it is, and turns into a formatted document. It differs in one basic way.

MyMark has no hard-wired notations. Every notation, even emphasis, is a definition. Definitions live in a notation sheet, which is itself just a MyMark file. Most documents use the standard sheet, std.mym, and define nothing of their own. An author who wants a notation of their own can add one, in the document or in a sheet of their own.

The standard sheet mimics Markdown, so a basic MyMark document reads, and publishes, much like a Markdown one. Beyond that, the same mechanism gives MyMark the notations that Markdown leaves to HTML, and a clean way round Markdown's awkward corners.

Each example below shows the MyMark text, then what it becomes.

Familiar ground

Headings, paragraphs and lists look as they do in Markdown.

## A heading

A paragraph is a line of text, or several. A blank line ends it.

- a bullet
- another bullet

A heading

A paragraph is a line of text, or several. A blank line ends it.

  • a bullet
  • another bullet

Emphasis, strong text and code:

Some *emphasis*, some **strong words**, and some `code`.

Some emphasis, some strong words, and some code.

Links and images:

See [Djot](https://djot.net), or <https://commonmark.org>.
An image: ![a small square](square.svg).

See Djot, or https://commonmark.org.
An image: a small square.

A link can name its address elsewhere, as in Markdown:

The [CommonMark] spec.

[CommonMark]: https://spec.commonmark.org

The CommonMark spec.

Quotes, and a rule:

> A quote,
> in two paragraphs.
>
> A bare > line comes between them.

---

A quote,
in two paragraphs.

A bare > line comes between them.


Tables, as GitHub and GitLab write them. A colon in the row of dashes aligns its column, and a bar inside code needs no escape:

| Notation | Means           | Width |
|----------|:---------------:|------:|
| `*...*`  | emphasis        | 5     |
| `a|b`    | code with a bar | 5     |
NotationMeansWidth
*...*emphasis5
a|bcode with a bar5

GitHub's Markdown adds struck-out text, task lists and footnotes, and so does the standard sheet:

- [x] ~~write the draft~~
- [ ] send it round[^1]

[^1]: Footnotes are shown where they are written, usually at the end.
  • write the draft
  • send it round1

1 Footnotes are shown where they are written, usually at the end. ↩

The contents at the top of this page come from a line of its own, [TOC], as GitLab's Markdown writes it: links to the headings, made from their text.

Numbered lists are written as in Markdown, and numbered for you: the first number says where to start, and the others are not read, so 1. will do for every item. Only 1. to 9. are labels, so a long list is best written all 1., or with +, MyMark's own form, which needs no numbers at all:

1. Markdown's way
1. numbered for you

and MyMark's own:

+ also numbered
+ with no numbers to write
  1. Markdown's way
  2. numbered for you

and MyMark's own:

  1. also numbered
  2. with no numbers to write

A list carries on across blank lines, as long as its items keep coming, so a blank line between items is fine. Two lists one after the other are written with their list label, List:, the items as its bar lines:

List:
| - one list
List:
| - and another
  • one list
  • and another

One difference from Markdown: a line break is kept where you put it.

Roses are red,
violets are blue.

Roses are red,
violets are blue.

Beyond Markdown

Markdown has a handful of notations, then falls back to HTML. MyMark's notations have one general form instead: an element is a sigil, perhaps a name, and a bag of content in brackets. The standard sheet defines a few with symbols:

Water is H_(2)O, and E = mc^(2).

Water is H2O, and E = mc2.

and many more with names, after a dot:

Some .mark(highlighted words), H.sub(2)O, and x.sup(2).

Some highlighted words, H2O, and x2.

The brackets may be ( ), [ ] or { }, whichever reads best:

.mark(round), .mark[square] and .mark{curly} mean the same.

round, square and curly mean the same.

The choice also lets the content hold a bracket of another kind:

A wink in code: `[;-)]

A wink in code: ;-)

Glyphs are named by what they look like:

~c 2026 ~smile, or ~(c) and ~(smile)

Β© 2026 πŸ™‚, or Β© and πŸ™‚

Notations of your own

A definition is a line with three parts: the notation, written as an example with ... where the content goes; an arrow, ->; and what to do with it, the name of a function and anything it needs. This one says that .hi(...) means a highlight, the same as .mark:

The .hi(important) part.

.hi(...) -> mark

The important part.

An inline definition can go anywhere in the document, as a Markdown reference can, and it is left out of what the reader sees. The functions it names come with the notation sheet: std.mym brings std_html.py, which turns each notation into HTML.

A name that the definition does not give becomes a class, which a style sheet can use. The standard sheet's emphasis takes any name, and its style sheet colours red:

A *red(warning).

A warning.

For a class with no other meaning, there is a generic notation for each level: span, for words, and div, for a block that holds other blocks, as a callout does. Each name is defined, so nothing else is caught, and the class can be the name or another:

.hot(...) -> span red
.box ... => div callout

The .hot(hot) part.

.box A box of class callout,
| so the style sheet draws it as one.

The hot part.

A box of class callout,
so the style sheet draws it as one.

A notation can also be made of others, with no code: a macro. And for anything more, a function of your own, in Python. A guide, Notations of your own, shows both.

A notation with no definition is simply text, so prose never turns into markup by accident:

list.append(x), snake_case(x), and .unknown(this) are left as written.

list.append(x), snake_case(x), and .unknown(this) are left as written.

Blocks

A block is a line with a label at its start, and the lines after it, up to a blank line. The labels under Familiar ground are Markdown's: #, -, >, ---. In MyMark each one is a definition, like any other notation, so a block can be whatever a definition says.

The standard sheet adds callouts: boxes set off from the text, to catch the eye. The ! says pay attention:

!tip Leave a blank line between blocks.

!warning As Markdown, a callout shows as a plain line, label and all.
πŸ’‘

Leave a blank line between blocks.

⚠️

As Markdown, a callout shows as a plain line, label and all.

A block is defined by a sample line: the label, then ... for the text, then => and the function with anything it needs. For a callout, that is its kind, which the style sheet colours, and its icon. So a kind of your own takes one line, which counts from where it stands, down the document, so it comes before the label is used:

!idea ... => callout idea 🌱

!idea Grow your own.
🌱

Grow your own.

A block can hold more than one line. Each line that starts with | belongs to the block above it, and the bar shows it: think of the thin grey guide line that an editor draws beside indented text. A bar is plain to see and leaves no doubt about tabs or spaces, and it nests: | | goes one level further in. What the lines hold is for the block's definition to say. A callout reads them as MyMark, so it can hold paragraphs, a list, even another callout:

!info One box can hold several paragraphs.
|
| A bare bar is a blank line inside the box.
| The lines can hold any blocks:
| - a list
| - another callout
|
| !tip A callout inside a callout.
| | Its own lines go one bar further in.
ℹ️

One box can hold several paragraphs.

A bare bar is a blank line inside the box.
The lines can hold any blocks:

  • a list
  • another callout
πŸ’‘

A callout inside a callout.
Its own lines go one bar further in.

A list item reads its | lines the same way, so lists nest, and an item can hold more than one paragraph:

- fruit
| - apples
| - pears
| | - one more level
- vegetables, in order
| + carrots
| + peas
|
| and a paragraph to end the item
  • fruit

    • apples
    • pears

      • one more level
  • vegetables, in order

    1. carrots
    2. peas

    and a paragraph to end the item

A line continues the nearest block above it, however deep. In the demo, the bare | ends the list of carrots and peas, so the last line is a paragraph of the vegetables item; without it, the line would continue peas.

In a paragraph, a | line simply starts a new line. In a code block or a diagram, the lines are taken as they are.

A quote is a container too. Its > lines work as | lines do, and as they do in Markdown, so > > is a quote inside a quote:

> Who said:
> > The bar reads like a tree.

Who said:

The bar reads like a tree.

So there are three kinds of block: leaves, which hold lines of text; containers, which hold other blocks; and verbatim blocks, which hold text as it is. CommonMark makes the same split between leaf and container blocks, but builds it in; in MyMark each definition chooses.

The model for all this is Markdown's code fence. In Markdown, ``` starts a block of code, and the word after it names the programming language, for syntax highlighting. But a fence can hold any text, and tools such as Mermaid read the word as a cue to draw a diagram instead. So the fence became Markdown's one real extension point, though it was not designed as one. MyMark keeps the fence, and makes the word after it a label to be defined, like any other. A ```abc fence draws a box diagram, after Rick Workman's abc; its definition comes from the abc sheet, which this document names with a sheets: line. Here it is written with | lines; a Markdown fence, closed by a ``` line, works just as well:

```abc
| .------.    .------.
| | text | -> | HTML |
| '------'    '------'
β”Œβ”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”
β”‚ text β”‚ ─▢ β”‚ HTML β”‚
β””β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”˜

The word can name a format of your own. Rick Workman's array is a table with no bars at all: a row is a line, and wide space parts the cells, so one space can go inside a cell. It comes with the abc sheet, which this document names:

```array
| tea         3.50   hot
| lemon cake  4      *fresh*
tea3.50hot
lemon cake4fresh

Each example on this page is a fence too, a ```demo, which shows its text and then what it becomes. And MyMark takes the idea further than the fence: every block is an extension point, with a label, a definition and a function.

Finally, a plain word can be a label, which would be risky, since a line of prose may start with the same word. So a definition can ask for wide space, two spaces or more, between the label and the text, which prose rarely has. The standard sheet defines its note with two spaces before the ..., as Note: ... => callout note πŸ“:

Note:  set off by wide space after its label.

Note: with one space, this is just a line of prose.
πŸ“

set off by wide space after its label.

Note: with one space, this is just a line of prose.

Markdown's awkward corners

Some of Markdown's notations need a rulebook to read. MyMark settles each one with brackets.

Emphasis inside emphasis, which Markdown writes as ***bold** words* and sorts out by rules about runs of stars. MyMark puts the outer emphasis in brackets:

*(**bold** words)*

bold words

Code that holds a backtick, which Markdown writes by doubling the backticks around it. In MyMark the code goes in brackets:

`(a`b)`

a`b

Code that starts or ends with a backtick, which in Markdown requires a space that it then removes. In brackets, the spaces are kept:

`( `x` )`

`x`

Text that would otherwise be read as markup, which Markdown escapes with backslashes. MyMark has no escape codes; the dot with no name gives its content as plain text:

.(*not emphasis*), and 2 * 3 * 4 is just arithmetic.

*not emphasis*, and 2 * 3 * 4 is just arithmetic.

Publishing as Markdown

A MyMark document that keeps to the familiar ground is also a Markdown document: GitLab or GitHub will show it as a README. Headings, paragraphs, - lists, > quotes, --- rules, ``` code fences, tables, task lists, ~~struck~~ text and footnotes carry over, and so do *emphasis*, **strong**, `code`, links, images and <addresses>. A [label]: address line is hidden by Markdown, as it is by MyMark.

A few things to know:

Metadata and sheets

A document can say a few things about itself, in lines at the top. Each is a name and a colon, then wide space, as for Note:, so a line of prose that starts with "title:" is not taken for one:

title:  MyMark: an introduction
author:  Peter Cashin
date:  2026-10-24

These lines show nothing where they are. They may go anywhere in the document, as definitions may, but only at its top level: a line that starts at the left margin, with nothing in front of it, and is not between the opening and closing lines of a fence. Inside a callout, a list item or a demo they are ordinary text. The example above is inside a fence, so it is only an example, not this document's metadata, though it looks the same: a fence marks its inside only at its two ends, where a bar marks every line. The title is the page's title, the one a browser shows on its tab; without one, the first level 1 heading is the title. The others go in the head of the page. A name of your own is one more definition: keywords: ... => meta keywords.

A document can also bring in a notation sheet of its own:

sheets:  my.mym

The sheet is read after the standard sheet and before the document's own definitions, so the document still has the last word. It brings its functions with it, my_html.py beside my.mym. A sheet is a MyMark file, and only its definition lines count, so it can be a document as well: the definitions of a notation, with its manual and examples around them.

How it works

A MyMark text is read in three steps. First a small grammar reads it as lines, each with perhaps a label and its text; it knows no notations at all. Then the definitions say what each label means: how its line gathers the lines after it into a block, and how that block's content is read. Last, each block's text is read by a second small grammar, as words, symbols and bags of content in brackets, and the inline definitions, compiled into grammar rules, find the notations in it. The formal model, model.mym, has the whole story.

Where two notations could apply, the longest one wins. So `print(x)` is a code span, print(x) in code, and not the code notation `print(x) with print as its name and a stray backtick after it: the code span reaches further.

So the standard sheet is not special. It is a MyMark file, std.mym, with functions to match, std_html.py, and an author can read it, change it, or replace it. Even a bare line being a paragraph, and the bar nesting what is under it, are definitions, in a smaller sheet that is read first, boot.mym.

Relatives

MyMark is not the first attempt to do better than Markdown, and two others share part of its thinking:

Its own forerunner is MyWord, Peter Cashin’s earlier markup designed with Rick Workman, and still used by Rick for his documentation. The idea of a notation sheet that is also its manual comes from there, and so do Rick’s abc diagrams.