Markdown compiling

This commit is contained in:
2020-06-09 16:43:41 +02:00
parent e22f774385
commit 882635cfc0
5 changed files with 442 additions and 44 deletions
+19
View File
@@ -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)
}