Skip to content

Commit

Permalink
use regex in TeX replace function to catch repeating occurences (jupy…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i authored Mar 6, 2024
1 parent 329ada3 commit a0e1ce6
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 a0e1ce6

Please sign in to comment.