MultiMarkdown

“As the world goes multi-platform with all of the new mobile operating systems, MultiMarkdown provides an easy way to share formatting between all of my devices. It’s easy to learn (even for us mortals) and immediately useful.”

— David Sparks, MacSparky.com

“Personally, it’s changed my game — it’s how I think now. Can’t imagine writing more than a paragraph in anything that doesn’t do MMD.”

— Merlin Mann, kung fu grippe

What is MultiMarkdown?

MultiMarkdown, or MMD, is a tool to help turn minimally marked-up plain text into well formatted documents, including HTML, PDF (by way of LaTeX), OPML, or OpenDocument (specifically, Flat OpenDocument or ‘.fodt’, which can in turn be converted into RTF, Microsoft Word, or virtually any other word-processing format).

MMD is a superset of the Markdown syntax, originally created by John Gruber. It adds multiple syntax features (tables, footnotes, and citations, to name a few), in addition to the various output formats listed above (Markdown only creates HTML). Additionally, it builds in “smart” typography for various languages (proper left- and right-sided quotes, for example).

MultiMarkdown started as a Perl script, which was modified from the original Markdown.pl.

MultiMarkdown v3 (aka ‘peg-multimarkdown’) was based on John MacFarlane’s peg-markdown. It used a parsing expression grammar (PEG), and was written in C in order to compile on almost any operating system. Thanks to work by Daniel Jalkut, MMD v3 was built so that it didn’t have any external library requirements.

MultiMarkdown v4 is basically a complete rewrite of v3. It uses the same basic PEG for parsing (Multi)Markdown text, but otherwise is almost completely rebuilt:

  • The code is designed to be easier to maintain — it’s divided into separate files on a more logical structure
  • All memory leaks (to my knowledge) have been fixed
  • [greg] is used instead of [peg/leg] to create the parser — this allows the parser to be thread-safe
  • The [test suite] has been modified to account for several improvements. MMD should fail one of the basic Markdown tests (see peg-markdown for more information). Currently it fails one of the LaTeX tests — this is not intentional and I am working on a fix.
  • Command line options are slightly different.

For another description of what MultiMarkdown is, you can also check out a PDF slide show that describes and demonstrates how MultiMarkdown can be used.

Why should I use MultiMarkdown?

Writing with MultiMarkdown allows you to separate the content and structure of your document from the formatting. You focus on the actual writing, without having to worry about making the styles of your chapter headers match, or ensuring the proper spacing between paragraphs. And with a little forethought, a single plain text document can easily be converted into multiple output formats without having to rewrite the entire thing or format it by hand. Even better, you don’t have to write in “computer-ese” to create well formatted HTML or LaTeX commands. You just write, MultiMarkdown takes care of the rest.

For example, instead of writing:

<p>In order to create valid 
<a href="http://en.wikipedia.org/wiki/HTML">HTML</a>, you 
need properly coded syntax that can be cumbersome for 
&#8220;non-programmers&#8221; to write. Sometimes, you
just want to easily make certain words <strong>bold
</strong>, and certain words <em>italicized</em> without
having to remember the syntax. Additionally, for example,
creating lists:</p>

<ul>
<li>should be easy</li>
<li>should not involve programming</li>
</ul>

You simply write:

In order to create valid [HTML], you need properly
coded syntax that can be cumbersome for 
"non-programmers" to write. Sometimes, you just want
to easily make certain words **bold**, and certain 
words *italicized* without having to remember the 
syntax. Additionally, for example, creating lists:

* should be easy
* should not involve programming

[HTML]: http://en.wikipedia.org/wiki/HTML

Additionally, you can write a MultiMarkdown document in any text editor, on any operating system, and know that it will be compatible with MultiMarkdown on any other operating system and processed into the same output. As a plain text format, your documents will be safe no matter how many times you switch computers, operating systems, or favorite applications. You will always be able to open and edit your documents, even when the version of the software you originally wrote them in is long gone.

These features have prompted several people to use MultiMarkdown in the process of writing their books, theses, and countless other documents.

There are many other reasons to use MultiMarkdown, but I won’t get into all of them here.

By the way — this web site is created using MultiMarkdown. To view the MMD source for any page, add .txt to the end of the URL. If the URL ends with /, then add index.txt to the end instead. This page, for example, would be “/multimarkdown/index.txt”.