@editorialapp/datatools
Version:
A collection of dependencies organized into useful tools for working with data in ways that are common in data cleaning and in building news apps.
18 lines (14 loc) • 438 B
JavaScript
import { remark } from 'remark'
import html from 'remark-html'
export async function markdownToHtml (input, options = {}) {
const parser = await remark()
if (options.plugins && options.plugins.length) {
for (const plugin of options.plugins) {
parser.use(plugin)
}
}
parser.use(html, options)
parser.data('settings', { commonmark: true, emphasis: '_', strong: '*' })
const file = await parser.process(input)
return file
}