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>
This commit is contained in:
Giulia Ye 2026-03-16 11:54:14 +01:00 committed by GitHub
parent 603b47f9b0
commit 50e5f89e9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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-");