Module ringo/markdown
A fast and extensible Markdown formatter.
Functions
- process(text, [extension])
process (text, [extension])
Converts a string of Markdown formatted text to HTML.
Passing in an optional JavaScript object as argument allows the caller to override behaviour in the markdown processor. Specifically, the following methods can be overridden:
-
getLink(id) called to resolve Markdown link ids. Takes a single string id as argument and must return an array containing the target link and the target link title. If this returns null, the markdown link will not be rendered as HTML link.
-
openTag(tagname, buffer) called when a HTML tag is opened.
tagnameis an HTML tag such aspreordiv, buffer is a java.lang.StringBuffer to append to. The function can be used to create HTML tags with additional attributes.
Parameters
| String | text | a Markdown formatted text |
| Object | [extension] | optional object with methods overriding default behaviour in org.ringojs.util.MarkdownProcessor |
Returns
| String | the Markdown text converted to HTML |