Skip to content

Commit

Permalink
use regex in TeX replace function to catch repeating occurences
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed Mar 5, 2024
1 parent e3cd019 commit ae025ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/jupyter-ai/src/components/rendermime-markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type RendermimeMarkdownProps = {
*/
function escapeLatexDelimiters(text: string) {
return text
.replace('\\(', '\\\\(')
.replace('\\)', '\\\\)')
.replace('\\[', '\\\\[')
.replace('\\]', '\\\\]');
.replace(/\\\(/g, '\\\\(')
.replace(/\\\)/g, '\\\\)')
.replace(/\\\[/g, '\\\\[')
.replace(/\\\]/g, '\\\\]');
}

function RendermimeMarkdownBase(props: RendermimeMarkdownProps): JSX.Element {
Expand Down

0 comments on commit ae025ad

Please sign in to comment.