Mobiledoc Markdown Renderer
To learn more about Mobiledoc cards and renderers, see the Mobiledoc Cards docs.
The renderer is a small library intended for use in servers that are building markdown documents. It may be of limited use inside browsers as well.
var mobiledoc ="version": "0.3.0""atoms":"cards":"markups":"strong""sections":1"p"00"Hello "001"world!";var renderer = cards: ;var rendered = renderer;console; // "Hello **world!**"
The Renderer constructor accepts a single object with the following optional properties:
cards[array] - The list of card objects that the renderer may encounter in the mobiledoc
cardOptions[object] - Options to pass to cards when they are rendered
unknownCardHandler[function] - Will be called when any unknown card is enountered
unknownAtomHandler[function] - Will be called when any unknown atom is enountered
The return value from
renderer.render(mobiledoc) is an object with two properties:
result[string] - The rendered result
teardown[function] - When called, this function will tear down the rendered mobiledoc and call any teardown handlers that were registered by cards when they were rendered
Or in the browser:
- visit http://localhost:4200/tests
This library is based on the mobiledoc-html-renderer by Cory Forsyth.