aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-04-30 08:19:36 +0200
committerache <ache@ache.one>2018-04-30 08:19:36 +0200
commit4b3bc89e90b295ccff1e3ba36be17a76a571dc8b (patch)
tree7be95526a6e3f3b53694cf73c79d0283779e1406
parentCancel parsing error (diff)
Add new plugins
-rw-r--r--package.json11
-rw-r--r--tohtml.js21
2 files changed, 26 insertions, 6 deletions
diff --git a/package.json b/package.json
index 4bca5d1..54e29a4 100644
--- a/package.json
+++ b/package.json
@@ -18,17 +18,16 @@
"remark-custom-blocks": "^2.1.1",
"remark-highlight.js": "^5.0.0",
"remark-html": "^6.0.1",
+ "remark-iframes": "^3.0.1",
"remark-kbd": "^1.0.6",
- "remark-line-input": "git+http://git.ache.one/remark-line-input/",
+ "remark-line-input": "^0.3.0",
+ "remark-text-input": "^0.5.0",
"remark-math": "^1.0.0",
- "remark-mermaid-simple": "git+http://git.ache.one/remark-mermaid-simple/",
- "remark-multiple-choice": "git+http://git.ache.one/remark-multiple-choice",
+ "remark-multiple-choice": "^0.1.0",
"remark-parse": "^5.0.0",
"remark-preset-lint-markdown-style-guide": "^2.1.1",
"remark-rehype": "^3.0.0",
- "remark-select": "git+http://git.ache.one/remark-select/",
- "remark-special-box": "git+http://git.ache.one/remark-special-box/",
- "remark-text-input": "git+http://git.ache.one/remark-text-input/",
+ "remark-select": "",
"unified": "^6.1.6",
"unist-util-inspect": "^4.1.2",
"vfile-reporter": "^4.0.0"
diff --git a/tohtml.js b/tohtml.js
index 35173b4..4a5982d 100644
--- a/tohtml.js
+++ b/tohtml.js
@@ -19,6 +19,7 @@ const rehypeStringify = require('rehype-stringify');
const unified = require('unified');
const remark = require('remark-parse');
const customBlocks = require('remark-custom-blocks');
+const iframes = require('remark-iframes');
function toHTML(data, fnc) {
unified()
@@ -58,6 +59,26 @@ function toHTML(data, fnc) {
classes: 'special-box bad',
}})
.use(highlight)
+ .use(iframes, {
+ // this key corresponds to the hostname: !(http://hostname/foo)
+ // the config associated to this hostname will apply to any iframe
+ // with a matching hostname
+ 'www.youtube.com': {
+ tag: 'IFRAME',
+ width: 560,
+ height: 315,
+ disabled: false,
+ replace: [
+ ['watch?v=', 'embed/'],
+ ['http://', 'https://'],
+ ],
+ thumbnail: {
+ format: 'http://img.youtube.com/vi/{id}/0.jpg',
+ id: '.+/(.+)$'
+ },
+ removeAfter: '&'
+ }
+ })
.use(html, {allowDangerousHTML: true})
.use(rehypeKatex)
.use(raw)