diff options
author | ache <ache@ache.one> | 2018-04-30 08:19:36 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2018-04-30 08:19:36 +0200 |
commit | 4b3bc89e90b295ccff1e3ba36be17a76a571dc8b (patch) | |
tree | 7be95526a6e3f3b53694cf73c79d0283779e1406 /tohtml.js | |
parent | Cancel parsing error (diff) |
Add new plugins
Diffstat (limited to 'tohtml.js')
-rw-r--r-- | tohtml.js | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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) |