aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-04-14 04:14:43 +0200
committerache <ache@ache.one>2018-04-14 04:14:43 +0200
commitb6b66b9fe10a82b44884be3e27941bd6ab020715 (patch)
treec3febfb083173d364aedcf8e1079fb3961fec595
parentStyle enhancement (diff)
Ajout de remark-custom-blocks
-rw-r--r--package.json1
-rw-r--r--tohtml.js24
2 files changed, 25 insertions, 0 deletions
diff --git a/package.json b/package.json
index 0a8f14a..4bca5d1 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
"rehype-raw": "^2.0.0",
"rehype-stringify": "^3.0.0",
"remark": "^8.0.0",
+ "remark-custom-blocks": "^2.1.1",
"remark-highlight.js": "^5.0.0",
"remark-html": "^6.0.1",
"remark-kbd": "^1.0.6",
diff --git a/tohtml.js b/tohtml.js
index 1d0ae2c..b18c944 100644
--- a/tohtml.js
+++ b/tohtml.js
@@ -20,6 +20,7 @@ const rehypeKatex = require('rehype-katex');
const rehypeStringify = require('rehype-stringify');
const unified = require('unified');
const remark = require('remark-parse');
+const customBlocks = require('remark-custom-blocks');
function toHTML(data, fnc) {
@@ -32,6 +33,29 @@ function toHTML(data, fnc) {
.use(math)
.use(kbd)
.use(sb)
+ .use(customBlocks, {
+ information: {
+ classes: 'special-box information',
+ title: 'optional'
+ },
+ comment: {
+ classes: 'special-box comment',
+ title: 'optional'
+ },
+ attention: {
+ classes: 'special-box attention',
+ title: 'optional'
+ },
+ question: {
+ classes: 'special-box question',
+ title: 'optional'
+ },
+ good: {
+ classes: 'special-box good',
+ },
+ bad: {
+ classes: 'special-box bad',
+ }})
.use(highlight)
.use(html, {allowDangerousHTML: true})
.use(rehypeKatex)