diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index f016218ba..935313d0f 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -243,17 +243,19 @@ const definitionLists = { let match; const endIndex = src.match(`\n\n`)?.index + 2; const allDefinitions = []; - let currentDefinition = []; + let currentDefinition = {}; while (match = regex.exec(src)) { if(match[1].trim()?.length) { if(currentDefinition?.dt?.length) { allDefinitions.push(currentDefinition); - currentDefinition = []; + currentDefinition = {}; } currentDefinition = { dt : this.lexer.inlineTokens(match[1].trim()), dd : [] }; + } else if(_.isEmpty(currentDefinition)) { + return; } currentDefinition.dd = currentDefinition.dd.concat(match[2].split('::').filter((item)=>item).map((s)=>this.lexer.inlineTokens(s.trim()))); if(!currentDefinition.dd?.length) { @@ -273,7 +275,7 @@ const definitionLists = { let returnVal = `