peg-markdown (C) and rpeg-markdown (ruby gem)
jgm at berkeley.edu
Sat Aug 9 15:59:27 EDT 2008
I've released version 0.4.1 of peg-markdown, a C implementation of
markdown. peg-markdown uses Ian Piumarta's peg/leg parser generator to
generate a parser from a parsing expression grammar (PEG). You can
inspect the grammar for markdown at
peg-markdown now provides both a C library and a standalone 'markdown'
program. The memory leaks in previous versions have been plugged, and
parsing accuracy has been improved considerably.
peg-markdown is very fast (on my machine, it parses a 178K benchmark
file in 0.175 seconds; that's over 30 times faster than Markdown.pl
v1.0.1). Optional syntax extensions are provided for footnotes and smart
typography (these can be enabled using command-line switches). In
addition to HTML, peg-markdown can convert markdown to LaTeX or
groff-mm. Adding writers for other formats would be an easy task.
You can download a tarball of version 0.4.1 at
Or, to clone the repository,
git clone git://github.com/jgm/peg-markdown.git
In addition, Ryan Tomayko has created a ruby gem, rpeg-markdown, that
wraps peg-markdown. He has published it on rubyforge, so you should
be able to install it with
gem install rpeg-markdown
(If the extension fails to build, it is probably because you need to
install glib: http://www.gtk.org/download.html.) The source is at
rpeg-markdown's API imitates BlueCloth's, so it should be easy to
replace BlueCloth with rpeg-markdown in web applications.
More information about the Markdown-Discuss