Markdown compiling
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import markdown from 'remark-parse'
|
||||
import remark2rehype from 'remark-rehype'
|
||||
import remarkBreaks from 'remark-breaks'
|
||||
import unified from 'unified'
|
||||
import hast2html from '@starptech/prettyhtml-hast-to-html'
|
||||
|
||||
function stringify(options = {}) {
|
||||
this.Compiler = (tree) => hast2html(tree, options)
|
||||
}
|
||||
|
||||
const compiler = unified()
|
||||
.use(markdown)
|
||||
.use(remark2rehype)
|
||||
.use(remarkBreaks)
|
||||
.use(stringify)
|
||||
|
||||
export default function (input) {
|
||||
return compiler.processSync(input)
|
||||
}
|
||||
Reference in New Issue
Block a user