From 40fc422ab5d01808f6a8ba41be99b06e47648381 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 20 Mar 2024 13:31:10 +1300 Subject: [PATCH 1/2] Check inline DL has priority over multiline DL --- tests/markdown/definition-lists.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/markdown/definition-lists.test.js b/tests/markdown/definition-lists.test.js index 87ff6f617..9f5025d73 100644 --- a/tests/markdown/definition-lists.test.js +++ b/tests/markdown/definition-lists.test.js @@ -82,4 +82,10 @@ describe('Multiline Definition Lists', ()=>{ const rendered = Markdown.render(source).trim(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('\n
Definition 1 of a single-line DL
\n
Definition 1 of another single-line DL
\n
'); }); + + test('Inline DL has priority over Multiline', function() { + const source = 'Term 1 :: Inline definition 1\n:: Inline definition 2 (no DT)'; + const rendered = Markdown.render(source).trim(); + expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe('
Term 1
Inline definition 1
\n
Inline definition 2 (no DT)
\n
'); + }); }); From bae56b8b9dec8c5ac8f6b6df5daa530c30fcca72 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Fri, 22 Mar 2024 14:27:45 +1300 Subject: [PATCH 2/2] Fix crash when match is undefined --- shared/naturalcrit/markdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 939c2cc81..a99c1e543 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -337,7 +337,7 @@ const definitionListsMultiline = { const definitions = []; while (match = regex.exec(src)) { if(match[1]) { - if(this.lexer.blockTokens(match[1].trim())[0].type !== 'paragraph') // DT must not be another block-level token besides

+ if(this.lexer.blockTokens(match[1].trim())[0]?.type !== 'paragraph') // DT must not be another block-level token besides

break; definitions.push({ dt : this.lexer.inlineTokens(match[1].trim()),