A sample of mym
Each example below is a demo: its mym source as written, then what it becomes. A demo is a fence labelled ```demo, and definitions inside one stay in it.
Elements
An element is a sigil, perhaps a tag, and a bag of content. The definitions in std.mym say what each one means.
Water is H.sub(2)O, or H_(2)O for short, and E = mc^(2).
Water is H2O, or H2O for short, and E = mc2.
Some *(emphasis), some **(strong words), and *(**(strong) words) nested.
Some emphasis, some strong words, and strong words nested.
A *red(warning) takes a tag, and .mark(highlighted words) is a named tag.
A warning takes a tag, and highlighted words is a named tag.
Paragraphs and line breaks
A paragraph may be one long line, wrapped by the editor, or several lines. A line break is kept where the author put it.
A paragraph may be one long line, wrapped by the editor, and a blank line ends it.
A paragraph may be one long line, wrapped by the editor, and a blank line ends it.
Or it may have several lines,
and a line break is kept where the author put it.
: A line that starts with a colon folds into the line before it.
- 5 °C: a line that starts with a space is never a label, so this one continues the paragraph.
Or it may have several lines,
and a line break is kept where the author put it. A line that starts with a colon folds into the line before it.
- 5 °C: a line that starts with a space is never a label, so this one continues the paragraph.
Verbatim
Code, plain text and maths take their content as it is. A choice of brackets lets content hold an odd bracket.
Code: `(*(not emphasis) & <b>), and with an odd bracket: `[f(x].
Code: *(not emphasis) & <b>, and with an odd bracket: f(x.
Plain text, with no name on the dot: .(*not emphasis* & <b>), in the body font.
Plain text, with no name on the dot: *not emphasis* & <b>, in the body font.
Maths: $(x^2 + y_i).
Maths: x^2 + y_i.
A Markdown fence holds code lines that are never read as labels or definitions:
def f(x):
*(...) -> strong # code lines are never definitions
return x + 1
A ```abc fence is a box diagram, after Rick Workman's abc, from the abc sheet that this document names: corners, lines and arrows drawn in ASCII become Unicode box characters.
┌────┬────┐ ┌────────┐ │ NW │ NE ├────▶│ result │ ├────┼────┤ └────────┘ │ SW │ SE │ ▲ └────┴────┘ │
Links and glyphs
Links: @[pPEG] is defined below, and @(https://djot.net) is its own address.
@[pPEG] -> link https://github.com/pcanz/pPEG
Glyphs: a ~(->) b, 1999~(--)2024, ~(tm) ~(smile) and ~(c) 2026.
Links: pPEG is defined below, and https://djot.net is its own address.
Glyphs: a → b, 1999–2024, ™ 🙂 and © 2026.
Patterns that mimic Markdown
Every inline form is a pattern in std.mym. Some mimic Markdown, and quoted bags clean up what Markdown makes hard.
Markdown's forms: *emphasis*, **strong** and `code`.
Markdown's forms: emphasis, strong and code.
A star needs no space inside it, so 2 * 3 * 4 is just arithmetic.
A star needs no space inside it, so 2 * 3 * 4 is just arithmetic.
A quoted bag holds anything, so there is no need for ***: *(**bold** italic)*, and `( a`b )` is code with its backtick and spaces.
A quoted bag holds anything, so there is no need for ***: bold italic, and a`b is code with its backtick and spaces.
The longest match wins: `print(x)` is code, and so are `(a) and `(b), separately.
The longest match wins: print(x) is code, and so are a and b, separately.
Links: [Djot](https://djot.net), <https://commonmark.org>, a local <notes.html>, and [CommonMark] by reference.
[CommonMark]: https://spec.commonmark.org
An image: , or by reference, ![square].
[square]: square.svg
Links: Djot, https://commonmark.org, a local notes.html, and CommonMark by reference.
An image: , or by reference,
.
Square brackets are a link only if the label is defined, so these are text: [see *(this)], [1] and [x] (y). Angle brackets with space inside are text: <a b>.
Square brackets are a link only if the label is defined, so these are text: [see this], [1] and [x] (y). Angle brackets with space inside are text: <a b>.
Left alone
An element with no definition is text, but its content is still read.
Not defined, so left alone: .note(as written), ~(nosuch); but markup inside is read: .note(see *(this)).
Not defined, so left alone: .note(as written), ~(nosuch); but markup inside is read: .note(see this).
A definition with no tag is for no tag, so code in prose is left alone: list.append(x), snake_case(x), x^n(2), cost$total(5).
A definition with no tag is for no tag, so code in prose is left alone: list.append(x), snake_case(x), x^n(2), cost$total(5).
Never closed, so left alone too: .sub(2 and a sad face :(
Never closed, so left alone too: .sub(2 and a sad face :(
A sigil is any run of symbols that a pattern defines. Runs of one symbol are never split, so ** is never two *, and punctuation hard against an element stays punctuation.
Punctuation hard against an element: the end.*(Next), and so on...**(more).
Punctuation hard against an element: the end.Next, and so on...more.
H,(2)O, as std.mym defines it, but not =>(this), which it does not.
H2O, as std.mym defines it, but not =>(this), which it does not.
Never in conflict with English text: ·mark‹any (text] at all›.
Never in conflict with English text: any (text] at all.
A sigil and a name, with no bag, must start a word. std.mym uses it for glyphs; here it is defined for tags and mentions, which std.mym leaves alone:
Notes on #ideas for @peter, ~smile, but not peter@example.com or issue#12.
#? -> mark
@? -> strong
Notes on ideas for peter, 🙂, but not peter@example.com or issue#12.
Lists, quotes and callouts
- a bullet
- another, with a second line
that keeps its line break
+ the translator numbers these
+ so the author never does
- a bullet
- another, with a second line
that keeps its line break
- the translator numbers these
- so the author never does
3. Markdown's form: the first number is the start
1. and the others are not read
+ a + item carries on the same list
- Markdown's form: the first number is the start
- and the others are not read
- a + item carries on the same list
- an item's | lines hold a list of its own
| - like this
| | + and this, one level further in
-
an item's | lines hold a list of its own
-
like this
- and this, one level further in
-
> Each line with the label is a line of the quote,
and a line after it with no label continues it.
>
> A bare > starts a second paragraph, and a quote can hold
> > a quote, or a list:
> > - like this
Each line with the label is a line of the quote,
and a line after it with no label continues it.A bare > starts a second paragraph, and a quote can hold
a quote, or a list:
- like this
!tip a callout: a tip, an info or a warning
| a | line continues it, read as mym:
| - a list inside
!warning and the next label is a new box
a callout: a tip, an info or a warning
a | line continues it, read as mym:
- a list inside
and the next label is a new box
!aside ... => callout aside 🗒️
!aside a kind of my own, with no colour of its own yet
a kind of my own, with no colour of its own yet
Note: a note, set off by wide space after its label.
a note, set off by wide space after its label.
Note: with one space this is just a paragraph.
Note: with one space this is just a paragraph.
---
GitHub's additions
~~struck out~~, and ~~(with a ~ inside)~~
- [ ] a task
- [x] a task done
| - [ ] with a sub-task
A note[^1] and another[^why].
[^1]: Footnotes show where they are written.
[^why]: Each links back to its reference.
##### A level 5 heading
###### and level 6
Spans and divisions
.warn(...) -> span red
.aside ... => div callout
A .warn(span) with a class, and list.append(x) as written.
.aside A division with a class,
| holding a list:
| - one
| - two
A span with a class, and list.append(x) as written.
A division with a class,
holding a list:
- one
- two
Tables
| left | centre | right |
|:-----|:------:|------:|
| *a* | `x|y` | 1 |
| bags (a|b) hold bars || 22 |
| left | centre | right |
|---|---|---|
| a | x|y | 1 |
| bags (a|b) hold bars | 22 |
| without a row of dashes | it is not a table
| just lines
without a row of dashes | it is not a table
just lines
```array
| an array is a table, from the abc sheet
| with no bars
| an array | is a table, from the abc sheet |
| with | no bars |
Definitions in the document
A definition is a line anywhere, and is left out of the output. In a demo it stays in the demo.
Used only here: .warn(take care), a .key(Ctrl) key, and a new glyph ~(1/2).
.warn(...) -> span warning
.key(...) -> span
~(1/2) -> glyph ½
A definition line ends the paragraph before it, as a blank line does.
Used only here: take care, a Ctrl key, and a new glyph ½.
A definition line ends the paragraph before it, as a blank line does.
Any tag: =?(...) catches every tag with no definition of its own.
=?(...) -> mark
So =one(this) and =two(that) are marked.
Any tag: =?(...) catches every tag with no definition of its own.
So this and that are marked.
These lines look like definitions but are not, so they are text:
.oops(...) -> nosuchfunction
Paris -> London is two hours by train
These lines look like definitions but are not, so they are text:
.oops(...) -> nosuchfunction
Paris -> London is two hours by train