diff --git a/src/services/import/markdown.spec.ts b/src/services/import/markdown.spec.ts index ea98eca96..d2d8ea694 100644 --- a/src/services/import/markdown.spec.ts +++ b/src/services/import/markdown.spec.ts @@ -165,7 +165,7 @@ second line 2
  1. Hello
  2. { const input = `The equation is\u00a0$e=mc^{2}$.`; - const expected = /*html*/`

    The equation is \(e=mc^{2}\).

    `; + const expected = /*html*/`

    The equation is \\(e=mc^{2}\\).

    `; expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected); }); diff --git a/src/services/import/markdown.ts b/src/services/import/markdown.ts index 1613c2f57..6cc46caec 100644 --- a/src/services/import/markdown.ts +++ b/src/services/import/markdown.ts @@ -18,6 +18,10 @@ class CustomMarkdownRenderer extends Renderer { text = text.replaceAll(/\$\$(.+)\$\$/g, `\\\[$1\\\]`); + // Inline math + text = text.replaceAll(/\$(.+)\$/g, + `\\\($1\\\)`); + return text; }