mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-05-07 16:38:38 +00:00
Merge pull request #4764 from naturalcrit/Fix-Colons-break-highlighting
Fix multiline Definition List highlight breaking
This commit is contained in:
@@ -137,14 +137,14 @@ export function tokenizeCustomMarkdown(text) {
|
|||||||
for (let i = lineNumber + 1; i < lines.length; i++) {
|
for (let i = lineNumber + 1; i < lines.length; i++) {
|
||||||
const nextLine = lines[i];
|
const nextLine = lines[i];
|
||||||
const onlyColonsMatch = /^:*$/.test(nextLine);
|
const onlyColonsMatch = /^:*$/.test(nextLine);
|
||||||
const defMatch = /^(::)(.*\S.*)?\s*$/.exec(nextLine);
|
const defMatch = /^(::)(.+)$/.exec(nextLine);
|
||||||
if(!onlyColonsMatch && defMatch) {
|
if(!onlyColonsMatch && defMatch) {
|
||||||
defs.push({ colons: defMatch[1], desc: defMatch[2], line: i });
|
defs.push({ colons: defMatch[1], desc: defMatch[2], line: i });
|
||||||
endLine = i;
|
endLine = i;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defs.length > 0) {
|
if(defs.length > 0 && lineText.trim().length > 0) {
|
||||||
tokens.push({
|
tokens.push({
|
||||||
line : startLine,
|
line : startLine,
|
||||||
type : customTags.definitionList,
|
type : customTags.definitionList,
|
||||||
@@ -175,7 +175,7 @@ export function tokenizeCustomMarkdown(text) {
|
|||||||
line : d.line,
|
line : d.line,
|
||||||
type : customTags.definitionDesc,
|
type : customTags.definitionDesc,
|
||||||
from : d.colons.length,
|
from : d.colons.length,
|
||||||
to : d.colons.length + d.desc.length,
|
to : d.colons.length + d.desc?.length,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user