markdown implementation in C using PEG grammar

John MacFarlane jgm at
Fri May 2 20:52:56 EDT 2008

I've just uploaded an implementation of markdown in C. It defines
the syntax using a PEG grammar, so it should be easy to extend and
modify. Right now it can produce output in either HTML or LaTeX, but it
would be simple to add other output formats.

It's very fast: on my machine, it converts a 178K markdown file in
0.14 seconds (vs. 9.6 seconds for the latest and 0.57
seconds for phpmarkdown).

It passes all the tests in the Markdown 1.0.3 test suite, with one
exception (an edge case where there is room for disagreement).

It's on github at
If you use git, you can clone the repository:

git clone git://

Otherwise, download a tarball:

Once you're in the peg-markdown directory, you can compile the program
by typing 'make'. For convenience, all required dependencies are
included, including Ian Piumarta's excellent peg/leg parser generator.

If you just want to have a look at the formal grammar, it's here:


More information about the Markdown-Discuss mailing list