Skip to content

Build your personal knowledge base with Trilium Notes

feat(editor): make theme selector scoped to code tag regex more robust

Giulia Ye50e5f89e9a00
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-");