Em is a limited hypertext markup language that is designed to be maximally readable. It is similar to Markdown, but it has a few key advantages:
Em values readability over expressiveness. This means that it is rather limited in terms of what HTML it can produce. Most noticeably, only a very limited form of inline links are supported (see Lists and Inline formatting).
Em also values consistency and predictability. As such, the syntax is rather strict. This makes it a bit harder to learn, but much more predictable.
Em's complete and exact syntax is defined by its implementation (link), but a general description follows below. For longer examples, see the source code for this text (link) or the test file (link).
Em is implemented in portable awk, with an rc script to bind it together. It is written on and for Plan 9 primarily, but the rc code can (more or less) trivially be translated to POSIX shell; the work just hasn't been done yet.
Em also includes the rc script htwrap, which can be used to create a standalone HTML document from em output.
Italic, bold and teletype text is marked with the asterisk, the underscore and the backtick, respectively:
Example of *italic text*, _bold text_ and `teletype text`.
The marks are only valid in certain positions:
Inline references are created with square brackets:
Example of an inline reference [1]. [1] The quick brown fox ...
For more information about references, see Reference lists below.
Hyperlinks are a special case of inline references. When an inline reference refers to a reference containing only a web address, the inline reference is replaced with a hyperlink to that address.
It is available for download [2]. [2] v1.tgz
The above example translates to the following HTML:
<p>It is available for download (<a href="v1.tgz">link</a>). </p>
The default link text ("link") can be changed by setting the linktext environment variable.
Headings begin and end with the same number of equal signs:
= First-level heading = == Second-level heading ==
All lists start with a single space, followed by some marker.
Unordered lists are created with - :
- This is an unordered list - With two items
Ordered lists are created with n. :
1. This is an ordered list 2. With an item that spans two lines
Definition lists are created with term: :
dinosaur: an animal
Reference lists are created with [n] :
[1] This is a reference list [2] With two items
Unordered and ordered lists can be nested. An additional space at the beginning of the line increases the item level by one:
1. First level - Second level 2. First level
A reference list is a special type of list. It is a type of footnote list, to which you can make inline references:
See footnote [1]. [1] The quick brown fox ...
Note: There is a special type of reference list item called a hyperlink reference. It contains only a single word, without whitespace:
[1] http://example.com
Hyperlink reference items are removed in the final output, but you can still reference them inline:
You can download the file here [1].
Preformatted blocks start with a single tab:
#include <stdio.h> main() { puts("Hello world!\n"); }
Paragraphs start with no space:
This is a paragraph with two lines.
This is another paragraph.