This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
apps/server/src/services/import Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,12 @@ second line 2</code></pre><ul><li>Hello</li><li>world</li></ul><ol><li>Hello</li
188188 expect ( markdownService . renderToHtml ( input , "Title" ) ) . toStrictEqual ( expected ) ;
189189 } ) ;
190190
191+ it ( "converts multiple inline math expressions into Mathtex format" , ( ) => {
192+ const input = `Energy: $e=mc^{2}$, Force: $F=ma$.` ;
193+ const expected = /*html*/ `<p>Energy: <span class="math-tex">\\(e=mc^{2}\\)</span>, Force: <span class="math-tex">\\(F=ma\\)</span>.</p>` ;
194+ expect ( markdownService . renderToHtml ( input , "Title" ) ) . toStrictEqual ( expected ) ;
195+ } ) ;
196+
191197 it ( "converts display math expressions into Mathtex format" , ( ) => {
192198 const input = `$$\sqrt{x^{2}+1}$$` ;
193199 const expected = /*html*/ `<p><span class="math-tex">\\[\sqrt{x^{2}+1}\\]</span></p>` ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class CustomMarkdownRenderer extends Renderer {
2525 `<span class="math-tex">\\\[$1\\\]</span>` ) ;
2626
2727 // Inline math
28- text = text . replaceAll ( / (?< ! \\ ) \$ ( .+ ) \$ / g,
28+ text = text . replaceAll ( / (?< ! \\ ) \$ ( .+ ? ) \$ / g,
2929 `<span class="math-tex">\\\($1\\\)</span>` ) ;
3030 }
3131
You can’t perform that action at this time.
0 commit comments