From 50e5f89e9a001eb2ee3120f005e7fa3b8fc1b4b1 Mon Sep 17 00:00:00 2001 From: Giulia Ye Date: Mon, 16 Mar 2026 11:54:14 +0100 Subject: [PATCH] feat(editor): make theme selector scoped to code tag regex more robust Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/highlightjs/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/highlightjs/src/index.ts b/packages/highlightjs/src/index.ts index d9fa6c260b..053b7f5662 100644 --- a/packages/highlightjs/src/index.ts +++ b/packages/highlightjs/src/index.ts @@ -48,7 +48,7 @@ export function highlight(code: string, options: HighlightOptions) { } export function normalizeThemeCss(themeCss: string): string { - const themeSelectorScopedToCodeTag = /\bcode \.hljs-/.test(themeCss); + const themeSelectorScopedToCodeTag = /\bcode\s+\.hljs-/.test(themeCss); if (themeSelectorScopedToCodeTag) { themeCss = themeCss.replace(/\bcode\.hljs/g, ".hljs"); themeCss = themeCss.replace(/\bcode \.hljs-/g, ".hljs .hljs-");