aboutsummaryrefslogtreecommitdiff
path: root/tohtml.js
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 /tohtml.js
parentCancel parsing error (diff)
Add new plugins
Diffstat (limited to 'tohtml.js')
-rw-r--r--tohtml.js21
1 files changed, 21 insertions, 0 deletions
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)