mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
refactor(import/markdown): add guard condition for processing math
This commit is contained in:
parent
e6b9ecda5c
commit
721bf455e1
@ -14,6 +14,7 @@ class CustomMarkdownRenderer extends Renderer {
|
||||
paragraph(data: Tokens.Paragraph): string {
|
||||
let text = super.paragraph(data).trimEnd();
|
||||
|
||||
if (text.includes("$")) {
|
||||
// Display math
|
||||
text = text.replaceAll(/\$\$(.+)\$\$/g,
|
||||
`<span class="math-tex">\\\[$1\\\]</span>`);
|
||||
@ -21,6 +22,7 @@ class CustomMarkdownRenderer extends Renderer {
|
||||
// Inline math
|
||||
text = text.replaceAll(/\$(.+)\$/g,
|
||||
`<span class="math-tex">\\\($1\\\)</span>`);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user