From 05704944c62536c2ed0b816dad19206cd84af230 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 6 Dec 2017 13:41:54 +0100 Subject: "Init commit" --- app.js | 42 +++++++++++++++++++++++++++++++++++------- package.json | 13 +++++++++++-- public/index.html | 2 +- 3 files changed, 47 insertions(+), 10 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 = " " @@ -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)); }); diff --git a/package.json b/package.json index faa784a..5da9700 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,23 @@ "dependencies": { "directory-tree": "^2.0.0", "express": "^4.15.5", + "rehype-format": "^2.2.0", + "rehype-katex": "^1.0.0", "rehype-raw": "^2.0.0", + "rehype-stringify": "^3.0.0", "remark": "^8.0.0", "remark-highlight.js": "^5.0.0", "remark-html": "^6.0.1", "remark-kbd": "^1.0.6", - "remark-math": "^1.0.3", - "remark-mermaid-simple": "file:///home/ache/git/remark-mermaid-simple", + "remark-math": "^1.0.0", + "remark-qcm": "git+http://git.ache.one/remark-qcm", + "remark-mermaid-simple": "git+http://git.ache.one/remark-mermaid-simple/", + "remark-line-input": "git+http://git.ache.one/remark-line-input/", + "remark-text-input": "git+http://git.ache.one/remark-text-input/", + "remark-special-box": "git+http://git.ache.one/remark-special-box/", "remark-preset-lint-markdown-style-guide": "^2.1.1", + "remark-rehype": "^3.0.0", + "unist-util-inspect": "^4.1.2", "vfile-reporter": "^4.0.0" }, "author": "Titely", diff --git a/public/index.html b/public/index.html index 1a476fa..ba0b81c 100644 --- a/public/index.html +++ b/public/index.html @@ -7,12 +7,12 @@ - + -- cgit v1.2.3