From 92ce93cf56ce6a5da22b07a99c4f6cce9b32175b Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Wed, 23 Mar 2022 22:16:57 -0500 Subject: [PATCH] Support the ::: syntax for divs This syntax is from Pandoc: https://pandoc.org/MANUAL.html#divs-and-spans Also allow for three or more characters, e.g., """", :::::, ``````. --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 2541814..911570c 100644 --- a/src/index.js +++ b/src/index.js @@ -41,9 +41,9 @@ const microdown = function () { '', // pre format block - /^("""|```)(.*)\n((.*\n)*?)\1/gm, + /^("""+|:::+|```+)(.*)\n((.*\n)*?)\1/gm, (match, wrapper, c, text) => - wrapper === '"""' ? + !/`/.test(wrapper) ? tag('div', parse(text, options), {class: c}) : options && options.preCode ? tag('pre', tag('code', encode(text), {class: c}))