From 031504baa06f108657fae7a0098c6ecf19e758c1 Mon Sep 17 00:00:00 2001 From: Sergey Makhnatkin Date: Tue, 12 Nov 2024 12:25:25 +0100 Subject: [PATCH] feat(CodeBlock): removed automatic language identification for performance optimization (#468) --- .../CodeBlock/CodeBlockHighlight/CodeBlockHighlight.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.ts b/src/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.ts index 6b4f034a..8f8b9ceb 100644 --- a/src/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.ts +++ b/src/extensions/markdown/CodeBlock/CodeBlockHighlight/CodeBlockHighlight.ts @@ -169,9 +169,7 @@ export const CodeBlockHighlight: ExtensionAuto = (bui let nodes: Root['children']; const lang: string | undefined = node.attrs[codeBlockLangAttr]; - if (!lang) { - nodes = lowlight.highlightAuto(node.textContent).children; - } else if (lowlight.registered(lang)) { + if (lang && lowlight.registered(lang)) { nodes = lowlight.highlight(lang, node.textContent).children; } else { continue;