lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

+++ steve donovan [Aug 29 11 14:54 ]:
> On Mon, Aug 29, 2011 at 2:45 PM, Peter Odding <> wrote:
> > Did you try the discount module by Alex Bradbury? It's available in LuaRocks
> > (luarocks install lua-discount).
>  I see what you mean - practically instant conversion!
> But the problem would be that I have a customized markdown.lua which
> does the table-of-contents thing.

You might also be interested in the lunamark library

which parses markdown using an lpeg grammar.  Adding table of contents
would just require customizing some methods in the html writer.
I also plan to add some hooks that will allow customization of the
parser itself.

The last version I released, in 2009, suffered from stack overflows.
Hans Hagen, who is using some of the code in ConTeXt, helped me to fix these
and contributed many optimizations. Now lunamark can handle all the input I
throw at it, and it's even faster than my peg-markdown, written in C. It is
not quite as fast as discount, but it's still really fast: e.g. it parses a
680K benchmark file in 0.3 seconds on my laptop. (By comparison,
takes 15 seconds, pandoc --strict takes 1.8 seconds, and discount takes 0.08

I am planning to release 0.2 before too long; at that point I'll
also request upload to luarocks.