0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 17:32:38 +00:00
This commit is contained in:
Trevor Buckner
2025-03-25 18:02:12 -04:00
parent e159e57222
commit 4aa5a00a6d

View File

@@ -381,11 +381,17 @@ const forcedParagraphBreaks = {
tokenizer(src, tokens) { tokenizer(src, tokens) {
const regex = /^(:+)(?:\n|$)/ym; const regex = /^(:+)(?:\n|$)/ym;
const match = regex.exec(src); const match = regex.exec(src);
if(match?.length) { if(match?.length) {
let extraBreak = 0;
const lastToken = tokens[tokens.length - 1];
if(lastToken?.type == 'text')
extraBreak = 1;
return { return {
type : 'hardBreaks', // Should match "name" above type : 'hardBreaks', // Should match "name" above
raw : match[0], // Text to consume from the source raw : match[0], // Text to consume from the source
length : match[1].length, length : match[1].length + extraBreak,
text : '' text : ''
}; };
} }