mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
fix(client/syntax_highlighting): avoid crash if language not found
This commit is contained in:
@@ -61,7 +61,11 @@ export async function applySingleBlockSyntaxHighlight($codeBlock: JQuery<HTMLEle
|
||||
highlightedText = highlightAuto(text);
|
||||
} else if (normalizedMimeType) {
|
||||
await ensureMimeTypesForHighlighting(normalizedMimeType);
|
||||
highlightedText = highlight(text, { language: normalizedMimeType });
|
||||
try {
|
||||
highlightedText = highlight(text, { language: normalizedMimeType });
|
||||
} catch (e) {
|
||||
console.warn("Unable to apply syntax highlight.", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (highlightedText) {
|
||||
|
||||
Reference in New Issue
Block a user