Moon's Mark Down

by David A. Moon
December 2016



Introduction to MMD

MMD, like the original Markdown, is intended for writing plain-text documentation which is highly readable in source form, and is also very easy to translate to formatted text. MMD translates to HTML.

MMD is inspired by HBolio which I wrote some years past. The new development was partly to allow better handling of text styles using flag characters, and partly as an exercise to discover whether I still know how to program. (It turns out that I do, albeit with careless mistakes.)

Types of Lines

MMD processes input a line at a time. Each line is classified as an ordinary, blank, list, table, directive, or directed line.

An ordinary line goes directly to the output. See Character Translation and see Flag Characters about processing applied to ordinary lines.

A blank line indicates a paragraph boundary.

A list, table, or directive line is identified by its first character:

. directive line
* bulleted list line
# numbered list line
| table line (must also end with |)

Directive Lines

After the dot, a directive line contains the name of the directive. See Directives for a description of each directive. If there is anything non-blank on the line after the directive name, it is a directed line of that type. Otherwise, lines following the directive line are directed lines of that type, up to a line containing .end name.

List Lines

For readability, the * or # at the beginning of a list line can be preceded by spaces.

The * or # at the beginning of a list line can be repeated to indicate nesting. Thus:

* first bullet
 ** sub-bullet
 ** another sub-bullet
  *** sub-sub-bullet
* second bullet
# number one
 ## nested number one
 ## nested number two
    ### doubly nested
 ## nested again
# number two
formats as:
  1. number one
    1. nested number one
    2. nested number two
      1. doubly nested
    3. nested again
  2. number two

Table Lines

A line that begins and ends with a | character is a table line. It formats as one row of a table. | separates columns.

| characters can be surrounded by white space for readability. It has no effect on the formatted output.

|| is used in a heading row.

Thus:

|| Column One || Column Two || Column Three ||
| A            |      B      |        C      |
| 123          |     456     |       789     |
formats as:
Column One Column Two Column Three
A B C
123 456 789


Previous page   Table of Contents   Next page



Creative Commons License
MMD by David A. Moon is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Please inform me if you find this useful, or use any of the ideas embedded in it.
Comments and criticisms to dave underscore moon atsign alum dot mit dot edu.