From b6b66b9fe10a82b44884be3e27941bd6ab020715 Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 14 Apr 2018 04:14:43 +0200 Subject: Ajout de remark-custom-blocks --- package.json | 1 + tohtml.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) 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) -- cgit v1.2.3