Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(editor): make theme selector scoped to code tag replace regex more robust
Giulia Ye850f8ad93978
diff --git a/packages/highlightjs/src/index.ts b/packages/highlightjs/src/index.tsindex 053b7f5662..617aaf7ac5 100644--- a/packages/highlightjs/src/index.ts+++ b/packages/highlightjs/src/index.ts@@ -51,7 +51,7 @@ export function normalizeThemeCss(themeCss: string): string {const themeSelectorScopedToCodeTag = /\bcode\s+\.hljs-/.test(themeCss);if (themeSelectorScopedToCodeTag) {themeCss = themeCss.replace(/\bcode\.hljs/g, ".hljs");- themeCss = themeCss.replace(/\bcode \.hljs-/g, ".hljs .hljs-");+ themeCss = themeCss.replace(/\bcode\s+\.hljs-/g, ".hljs .hljs-");}// Increase the specificity of the HLJS selector to render properly within CKEditor without the need of patching the library.