aboutsummaryrefslogtreecommitdiff
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
parentUpdate everything (diff)
"Init commit"
-rw-r--r--app.js42
-rw-r--r--package.json13
-rw-r--r--public/index.html2
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 = " <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));
});
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 @@
<link rel="icon" type="image/png" href="img/favicon.png" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-AMS_HTML-full"></script>
<script src="js/script.js"></script>
<script src="js/qcm.js"></script>
<script src="./mermaid.min.js"></script>
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/rainbow.css">
</head>