From ab5b69f87cca37bffd53c914b66f6540a14e6dd0 Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 13 Apr 2018 12:01:17 +0200 Subject: tohtml is now in a new file --- tohtml.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tohtml.js (limited to 'tohtml.js') diff --git a/tohtml.js b/tohtml.js new file mode 100644 index 0000000..1d0ae2c --- /dev/null +++ b/tohtml.js @@ -0,0 +1,44 @@ +const path = 'md'; + +const report = require('vfile-reporter'); + +/* TODO : Send the result of guide : + const guide = require('remark-preset-lint-markdown-style-guide'); +*/ + +const html = require('remark-rehype'); +const kbd = require('remark-kbd'); +const math = require('remark-math'); +const highlight = require('remark-highlight.js'); +const sb = require('remark-special-box'); +const multiChoice = require('remark-multiple-choice'); +const lineInput = require('remark-line-input'); +const select = require('remark-select'); +const textInput = require('remark-text-input'); +const raw = require('rehype-raw'); +const rehypeKatex = require('rehype-katex'); +const rehypeStringify = require('rehype-stringify'); +const unified = require('unified'); +const remark = require('remark-parse'); + + +function toHTML(data, fnc) { + unified() + .use(remark) + .use(lineInput) + .use(textInput) + .use(select) + .use(multiChoice) + .use(math) + .use(kbd) + .use(sb) + .use(highlight) + .use(html, {allowDangerousHTML: true}) + .use(rehypeKatex) + .use(raw) + .use(rehypeStringify) + + .process(data, fnc); +} + +module.exports = toHTML; -- cgit v1.2.3