diff --git a/src/services/import/markdown.ts b/src/services/import/markdown.ts
index 6cc46caec..60f770bbd 100644
--- a/src/services/import/markdown.ts
+++ b/src/services/import/markdown.ts
@@ -14,13 +14,15 @@ class CustomMarkdownRenderer extends Renderer {
paragraph(data: Tokens.Paragraph): string {
let text = super.paragraph(data).trimEnd();
- // Display math
- text = text.replaceAll(/\$\$(.+)\$\$/g,
- `\\\[$1\\\]`);
+ if (text.includes("$")) {
+ // Display math
+ text = text.replaceAll(/\$\$(.+)\$\$/g,
+ `\\\[$1\\\]`);
- // Inline math
- text = text.replaceAll(/\$(.+)\$/g,
- `\\\($1\\\)`);
+ // Inline math
+ text = text.replaceAll(/\$(.+)\$/g,
+ `\\\($1\\\)`);
+ }
return text;
}