md-jml
Markdown to JsonML parser. This is a port of marked
to TypeScript.
Differences:
- Outputs JsonML AST instead of an HTML string.
- Written in TypeScript.
- Does not support highlighting functionality of
marked
, as it is better to do it by extending theAst
constructor function (a.k.a.Renderer
inmarked
) or by traversing the resulting JsonML tree. - Asynchronous AST generation.
- Not tested.
Unlike other Markdown parsers this module returns a JsonML AST of the resulting HTML instead of just an HTML string.
You can use that JsonML to easily concatenate it to an HTML string or
feed the JsonML to a virtual DOM rendering engine, like React.js
, Mithril.js
, virtual-dom
, etc...
Using marked
you get an HTML string:
var marked = ;console;// <p>I am using <strong>markdown</strong>.</p>
However, md-jml
returns a JsonML tree:
var md = ;md; // [ 'div',// [ 'p', null,// 'I am using ',// [ 'strong', null, 'markdown' ],// '.'// ]// ]
You can use the resulting JsonML to generate HTML using the jml-h
package:
var jmlh = ;var html = jmlh;console;// <div><p>I am using <strong>markdown</strong>.</p></div>