public
Description: A Markdown parser + object model in scala
Home | Edit | New

Home

Another Markdown Knockoff…

This time, with an object model!

But tell me, why do you want such a thing?

Because you want to mess with your Markdown output, that’s why! Say you want to HTML-ify your markdown document. Why not use the first header of the Markdown as the <title> of the <head>?

How to grab the first header of your markdown document.

Or default it to do something.

val blocks = KnockOff.parse( markdownSource ).get

val header = blocks.find( _.isInstanceOf[ Header ] ) match {
    case header:Header => SpanConverter( header.nads ).toString
    case None => "My Default Header"
}

Note that the object model and the “conversion” process is pretty alpha at this point. I haven’t used it much yet. That whole SpanConverter thing will get pimped at some point, probably to header.nads.text.

Last edited by tristanjuricek, Sat May 23 03:03:29 -0700 2009
Home | Edit | New
Versions: