markdown implementation in C using PEG grammar
John MacFarlane
jgm at berkeley.edu
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 Markdown.pl 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 http://github.com/jgm/peg-markdown/tree/master.
If you use git, you can clone the repository:
git clone git://github.com/jgm/peg-markdown.git
Otherwise, download a tarball:
http://github.com/jgm/peg-markdown/tarball/master
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:
http://github.com/jgm/peg-markdown/tree/master/markdown.leg#L675
John
More information about the Markdown-Discuss
mailing list