lunamark - markdown in lua using a PEG grammar
John MacFarlane
jgm at berkeley.edu
Fri Sep 11 23:30:44 EDT 2009
Markersdown:
I was fooling around with lua and decided to write a markdown parser
using the terrific lpeg library. Here's the result:
http://github.com/jgm/lunamark/tree/master
There are already two markdown libraries for lua, one a native lua
implementation based on global substitutions, the other a binding
to discount. What makes lunamark different is that it is based
on a PEG grammar (adapted from my peg-markdown). This can be found
in the file lunamark/markdown_parser.lua in the source tree.
Lunamark converts standard markdown to HTML and LaTeX. Adding
a new output format is easy (the LaTeX writer took about 20 minutes
to add). It is also possible to add new input formats.
Lunamark passes the Markdown 1.0.3 test suite (except for one edge
case involving loose/tight lists, and here its behavior is consistent
with the markdown syntax description -- see the README for peg-markdown
for discussion).
As for performance, lunamark is about the same speed as PHP Markdown in
my tests.
John
More information about the Markdown-Discuss
mailing list