Awesome
jstransformer-marked
Marked support for JSTransformers.
Installation
npm install jstransformer-marked
API
const marked = require('jstransformer')(require('jstransformer-marked'));
marked.render('# Hello World!').body
//=> '<h1>Hello World!</h1>'
const markedOptions = {}
marked.render('# "Hello World"', markedOptions)
// also supports async walkTokens
marked.renderAsync('# Hello World', {
walkTokens: async (token) => {
const uriPrefix = await uriPrefixAsync()
if (token.href) {
token.href = uriPrefix + token.href
}
}
})
For all supported options see https://marked.js.org/using_advanced#options
License
MIT