Fix blockcode with empty lines not rendered (#1524)
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Tue, 31 Oct 2023 03:18:30 +0000 (14:18 +1100)
committerGitHub <noreply@github.com>
Tue, 31 Oct 2023 03:18:30 +0000 (14:18 +1100)
src/app/plugins/markdown.ts

index c6bb3914a34873fe0f6e71fe12c5066dcde08a93..40427a7fc3593238ce4370d0a087a2e5177e6892 100644 (file)
@@ -248,7 +248,7 @@ const HeadingRule: BlockMDRule = {
 };
 
 const CODEBLOCK_MD_1 = '```';
-const CODEBLOCK_REG_1 = /^`{3}(\S*)\n((.+\n)+)`{3} *(?!.)\n?/m;
+const CODEBLOCK_REG_1 = /^`{3}(\S*)\n((?:.*\n)+?)`{3} *(?!.)\n?/m;
 const CodeBlockRule: BlockMDRule = {
   match: (text) => text.match(CODEBLOCK_REG_1),
   html: (match) => {
@@ -285,7 +285,7 @@ const O_LIST_ITEM_PREFIX = /^(-|[\da-zA-Z]\.) */;
 const O_LIST_START = /^([\d])\./;
 const O_LIST_TYPE = /^([aAiI])\./;
 const O_LIST_TRAILING_NEWLINE = /\n$/;
-const ORDERED_LIST_REG_1 = /(^(-|[\da-zA-Z]\.) +.+\n?)+/m;
+const ORDERED_LIST_REG_1 = /(^(?:-|[\da-zA-Z]\.) +.+\n?)+/m;
 const OrderedListRule: BlockMDRule = {
   match: (text) => text.match(ORDERED_LIST_REG_1),
   html: (match, parseInline) => {