peg-markdown (C) and rpeg-markdown (ruby gem)
John MacFarlane
jgm at berkeley.edu
Sat Aug 9 15:59:27 EDT 2008
Markdowners:
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
http://github.com/jgm/peg-markdown/tree/HEAD/markdown_parser.leg
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
http://github.com/jgm/peg-markdown/tarball/0.4.1
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
http://github.com/rtomayko/rpeg-markdown/tree/master
rpeg-markdown's API imitates BlueCloth's, so it should be easy to
replace BlueCloth with rpeg-markdown in web applications.
John
More information about the Markdown-Discuss
mailing list