mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 03:53:37 -06:00
fix(client/syntax_highlighting): avoid crash if language not found
This commit is contained in:
parent
95987d474d
commit
f36535d061
@ -61,7 +61,11 @@ export async function applySingleBlockSyntaxHighlight($codeBlock: JQuery<HTMLEle
|
||||
highlightedText = highlightAuto(text);
|
||||
} else if (normalizedMimeType) {
|
||||
await ensureMimeTypesForHighlighting(normalizedMimeType);
|
||||
try {
|
||||
highlightedText = highlight(text, { language: normalizedMimeType });
|
||||
} catch (e) {
|
||||
console.warn("Unable to apply syntax highlight.", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (highlightedText) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user