Skip to content

Commit

Permalink
Backport PR jupyterlab#675: Use regex in TeX replace function to catc…
Browse files Browse the repository at this point in the history
…h repeating symbol occurrences
  • Loading branch information
andrii-i authored and meeseeksmachine committed Mar 6, 2024
1 parent a6bbdec commit 7d32740
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 7d32740

Please sign in to comment.