0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 05:22:38 +00:00

Correct end of match criteria for justified paragraph to account for end of stream

This commit is contained in:
David Bolack
2024-12-17 21:48:11 -06:00
parent 08b0f47ea2
commit 99d3d28754

View File

@@ -383,7 +383,7 @@ const justifiedParagraphs = {
return src.match(/\n(?:-:|:-|-:) {1}/m)?.index;
}, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) {
const regex = /^(((:-))|((-:))|((:-:))) .+\n([^\n].*\n)*\n/ygm;
const regex = /^(((:-))|((-:))|((:-:))) .+(\n(([^\n].*\n)*(\n|$))|$)/ygm;
const match = regex.exec(src);
if(match?.length) {
let whichJustify;
@@ -396,7 +396,7 @@ const justifiedParagraphs = {
length : match[whichJustify].length,
text : match[0].slice(match[whichJustify].length),
class : justifiedParagraphClasses[whichJustify],
tokens : this.lexer.inlineTokens(match[0].slice(match[whichJustify].length))
tokens : this.lexer.inlineTokens(match[0].slice(match[whichJustify].length + 1))
};
}
},