mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-02 15:02:38 +00:00
Correct end of match criteria for justified paragraph to account for end of stream
This commit is contained in:
@@ -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))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user