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,13 +14,15 @@ class CustomMarkdownRenderer extends Renderer {
|
|||||||
paragraph(data: Tokens.Paragraph): string {
|
paragraph(data: Tokens.Paragraph): string {
|
||||||
let text = super.paragraph(data).trimEnd();
|
let text = super.paragraph(data).trimEnd();
|
||||||
|
|
||||||
// Display math
|
if (text.includes("$")) {
|
||||||
text = text.replaceAll(/\$\$(.+)\$\$/g,
|
// Display math
|
||||||
`<span class="math-tex">\\\[$1\\\]</span>`);
|
text = text.replaceAll(/\$\$(.+)\$\$/g,
|
||||||
|
`<span class="math-tex">\\\[$1\\\]</span>`);
|
||||||
|
|
||||||
// Inline math
|
// Inline math
|
||||||
text = text.replaceAll(/\$(.+)\$/g,
|
text = text.replaceAll(/\$(.+)\$/g,
|
||||||
`<span class="math-tex">\\\($1\\\)</span>`);
|
`<span class="math-tex">\\\($1\\\)</span>`);
|
||||||
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user