Markdown processor

Mathias edited this page Mar 21, 2011 · 3 revisions
Clone this wiki locally

The Markdown processor pegdown is implemented around a parboiled parser for the Markdown syntax (plus certain extensions) and serves as a good example for a complete application realized with parboiled.

pegdowns Markdown parser builds an abstract syntax tree representing the structure of the underlying Markdown document that is subsequently written out to HTML.

One speciality of pegdowns parsing approach is that for some Markdown elements (like blockquotes or list items) pegdowns parser first builds an “inner source” string that is then fed to another, inner parser instance to run a separate, recursive parse whose root AST node is then attached to the outer AST at the respective position. This recursive parser invocation strategy simplifies the grammar design as only one level of the respective language structures has to be modeled.