0.1.0 • Published 4 years ago
dessert-marked v0.1.0
Dessert Marked
marked, but implemented with Rust and WebAssembly
Table of contents
Usage
const marked = require('dessert-marked');
console.log(marked("hello world"));
Output
<p>hello world</p>
Advance usage
// Create reference instance
const marked = require('marked');
// Set options
// `highlight` example uses `highlight.js`
marked.setOptions({
gfm: true,
breaks: false,
headerPrefix: 'Hello'
});
// Compile
console.log(marked(markdownString));
API
marked(src, opt, callback)
Converts Markdown to HTML
marked.parse(src, opt, callback)
Same as the marked
function
getDefaults()
Returns the defaults options
setOptions({obj})
Member | type | Default | Notes |
---|---|---|---|
breaks | boolean | false | gf true, add <br> on a single line break (copies GitHub behavior on comments, but not on rendered markdown files). Requires gfm be true . |
gfm | boolean | true | If true, use approved GitHub Flavored Markdown (GFM) specification. |
headerIds | boolean | true | If true, include an id attribute when emitting headings (h1, h2, h3, etc). |
headerPrefix | string | '' | A string to prefix the id attribute when emitting headings (h1, h2, h3, etc). |
silent | boolean | false | If true, the parser does not throw any exception. |
Installation
With npm:
npm install dessert-marked
License
This software is licensed under the MIT license (see LICENSE).
Contributing
See CONTRIBUTING.md
0.1.0
4 years ago