[ANN] lunamark 0.2 - lpeg-based markdown converter

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] lunamark 0.2 - lpeg-based markdown converter

John MacFarlane
I'm pleased to announce the release of lunamark 0.2. This is a complete
rewrite of the 2009 version, with a new API. I am very grateful to Hans Hagen,
who resurrected the project for use in ConTeXt and made major improvements in
the efficiency and performance of the code.

Lunamark is a lua library and command-line program for conversion of markdown
to other textual formats. Currently HTML, dzslides (HTML5 slides), Docbook,
ConTeXt, LaTeX, and Groff man are the supported output formats, but it is easy
to add new writers or modify existing ones. The markdown parser is written
using a PEG grammar and can also be modified by the user.

The library is as portable as lua and has very good performance. It is
slightly faster than the author's own C library peg-markdown, an order of
magnitude faster than pandoc, two orders of magnitude faster than Markdown.pl,
and three orders of magnitude faster than markdown.lua.

The lunamark distribution includes the library and two programs:

  lunamark:  command-line markdown converter
  lunadoc:   a simple lua documentation tool

For more information, see lunamark's website: http://jgm.github.com/lunamark.

I will submit a rockspec to the luarocks repository shortly.

John


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lunamark 0.2 - lpeg-based markdown converter

Petite Abeille

On Sep 17, 2011, at 11:21 PM, John MacFarlane wrote:

> I'm pleased to announce the release of lunamark 0.2. This is a complete
> rewrite of the 2009 version, with a new API. I am very grateful to Hans Hagen,
> who resurrected the project for use in ConTeXt and made major improvements in
> the efficiency and performance of the code.

Sounds very promising :)

> The library is as portable as lua and has very good performance. It is
> slightly faster than the author's own C library peg-markdown, an order of
> magnitude faster than pandoc, two orders of magnitude faster than Markdown.pl,
> and three orders of magnitude faster than markdown.lua.

If you have a chance, could you include in your benchmark David Parsons' Discount library?

http://www.pell.portland.or.us/~orc/Code/markdown/
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lunamark 0.2 - lpeg-based markdown converter

Petite Abeille

On Sep 17, 2011, at 11:54 PM, Petite Abeille wrote:

> If you have a chance, could you include in your benchmark David Parsons' Discount library?

Never mind. It's there already :)

        • discount 0.14s
        • lunamark 0.42s
        • peg-markdown 0.50s
        • pandoc 4.97s
        • Markdown.pl (1.0.2b8) 56.75s
        • markdown.lua 996.14s



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lunamark 0.2 - lpeg-based markdown converter

Miles Bader-2
Petite Abeille <[hidden email]> writes:

>> If you have a chance, could you include in your benchmark David
>> Parsons' Discount library?
>
> Never mind. It's there already :)
>
> • discount 0.14s
> • lunamark 0.42s
> • peg-markdown 0.50s
> • pandoc 4.97s
> • Markdown.pl (1.0.2b8) 56.75s
> • markdown.lua 996.14s

One of the cool things about LPEG is that, after you get all excited
by how easy it is to write parsers, you then discover that it's _also_
gut-churningly fast... (and that's true even if you're doing tons of
Lua callbacks, especially if you're using LuaJIT)

-Miles

--
History, n. An account mostly false, of events mostly unimportant, which are
brought about by rulers mostly knaves, and soldiers mostly fools.


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lunamark 0.2 - lpeg-based markdown converter

Dirk Laurie
In reply to this post by John MacFarlane
On Sat, Sep 17, 2011 at 11:21:44PM +0200, John MacFarlane wrote:
> I'm pleased to announce the release of lunamark 0.2.
...
> The lunamark distribution includes the library and two programs:
>
>   lunamark:  command-line markdown converter
>   lunadoc:   a simple lua documentation tool
>
In the repository, there is a third program: /bin/shtest
which gives:

Passed: 52
Failed: 6

Is that expected behaviour at this stage?

Dirk

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lunamark 0.2 - lpeg-based markdown converter

Dirk Laurie
On Mon, Sep 19, 2011 at 07:43:07AM +0200, Dirk Laurie wrote:
> In the repository, there is a third program: /bin/shtest
> which gives:
>
> Passed: 52
> Failed: 6
>
> Is that expected behaviour at this stage?
>
The answer is 'yes', as any diligent reader who read all of
http://jgm.github.com/lunamark/ would have known.  Sorry for
the noise.

Dirk

Reply | Threaded
Open this post in threaded view
|

Re: lunamark 0.2 - lpeg-based markdown converter

John MacFarlane
+++ Dirk Laurie [Sep 19 11 10:47 ]:

> On Mon, Sep 19, 2011 at 07:43:07AM +0200, Dirk Laurie wrote:
> > In the repository, there is a third program: /bin/shtest
> > which gives:
> >
> > Passed: 52
> > Failed: 6
> >
> > Is that expected behaviour at this stage?
> >
> The answer is 'yes', as any diligent reader who read all of
> http://jgm.github.com/lunamark/ would have known.  Sorry for
> the noise.

Yes, these are failures on a standard PHP markdown test suite.
In one case, the HTML is actually semantically equivalent.
(And that failure goes away if you pass shtest the -n flag.)

In most of the other cases, I disagree with the PHP markdown
author about how markdown should behave.


Reply | Threaded
Open this post in threaded view
|

Re: lunamark 0.2 - lpeg-based markdown converter

John MacFarlane
In reply to this post by Miles Bader-2
+++ Miles Bader [Sep 18 11 15:11 ]:

> Petite Abeille <[hidden email]> writes:
> >> If you have a chance, could you include in your benchmark David
> >> Parsons' Discount library?
> >
> > Never mind. It's there already :)
> >
> > • discount 0.14s
> > • lunamark 0.42s
> > • peg-markdown 0.50s
> > • pandoc 4.97s
> > • Markdown.pl (1.0.2b8) 56.75s
> > • markdown.lua 996.14s
>
> One of the cool things about LPEG is that, after you get all excited
> by how easy it is to write parsers, you then discover that it's _also_
> gut-churningly fast... (and that's true even if you're doing tons of
> Lua callbacks, especially if you're using LuaJIT)

Yes, it's really amazing.  And I was just able to cut the benchmark down
to 0.35s by replacing some uses of string.gsub with lpeg.

John