0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-02 17:12:45 +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; return src.match(/\n(?:-:|:-|-:) {1}/m)?.index;
}, // Hint to Marked.js to stop and check for a match }, // Hint to Marked.js to stop and check for a match
tokenizer(src, tokens) { tokenizer(src, tokens) {
const regex = /^(((:-))|((-:))|((:-:))) .+\n([^\n].*\n)*\n/ygm; const regex = /^(((:-))|((-:))|((:-:))) .+(\n(([^\n].*\n)*(\n|$))|$)/ygm;
const match = regex.exec(src); const match = regex.exec(src);
if(match?.length) { if(match?.length) {
let whichJustify; let whichJustify;
@@ -396,7 +396,7 @@ const justifiedParagraphs = {
length : match[whichJustify].length, length : match[whichJustify].length,
text : match[0].slice(match[whichJustify].length), text : match[0].slice(match[whichJustify].length),
class : justifiedParagraphClasses[whichJustify], class : justifiedParagraphClasses[whichJustify],
tokens : this.lexer.inlineTokens(match[0].slice(match[whichJustify].length)) tokens : this.lexer.inlineTokens(match[0].slice(match[whichJustify].length + 1))
}; };
} }
}, },