aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorache <ache@ache.one>2017-12-06 13:41:54 +0100
committerache <ache@ache.one>2017-12-06 13:41:54 +0100
commit05704944c62536c2ed0b816dad19206cd84af230 (patch)
tree1fe71b4cb568c7bf67283e04b09c6e60e9450f1c /app.js
parentUpdate everything (diff)
"Init commit"
Diffstat (limited to 'app.js')
-rw-r--r--app.js42
1 files changed, 35 insertions, 7 deletions
diff --git a/app.js b/app.js
index 745c896..1657afd 100644
--- a/app.js
+++ b/app.js
@@ -15,16 +15,25 @@ process.on('uncaughtException', function(err) {
const report = require('vfile-reporter');
-const remark = require('remark');
const guide = require('remark-preset-lint-markdown-style-guide');
-const html = require('remark-html');
+const html = require('remark-rehype');
const kbd = require('remark-kbd');
const math = require('remark-math');
const mermaid = require('remark-mermaid-simple');
const highlight = require('remark-highlight.js');
const sb = require('remark-special-box');
const qcm = require('remark-qcm');
+const lineInput = require('remark-line-input');
+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');
+
+const inspect = require('unist-util-inspect');
const useLandScript = " <script> mermaid.contentLoaded(); </script>"
@@ -36,17 +45,36 @@ app.get('/' + path + '/*', function(req, res) {
fs.readFile(url.substr(1), 'utf8', function(err, data) {
if (err)
return console.log(err);
- remark()
+// remark()
+ /* Debbug comment
+ const a = unified()
+ .use(remark)
+ .use(mermaid)
+ .use(lineInput)
+ .use(textInput)
+ .use(html, {allowDangerousHTML: true})
+ .use(raw)
+ .parse(data)
+ console.log(inspect(a));
+ */
+
+ unified()
+ .use(remark)
.use(guide)
- .use(kbd)
- .use(math)
.use(mermaid)
+ .use(lineInput)
+ .use(textInput)
+ .use(math)
+ .use(kbd)
.use(sb)
.use(qcm)
.use(highlight)
- .use(html)
+ .use(html, {allowDangerousHTML: true})
+ .use(rehypeKatex)
+ .use(raw)
+ .use(rehypeStringify)
+
.process(data, function (err, file) {
- // console.log(head + String(file) + foot);
res.send(String(file) + useLandScript);
console.error(report(err || file));
});