diff --git a/packages/jupyter-ai/src/components/rendermime-markdown.tsx b/packages/jupyter-ai/src/components/rendermime-markdown.tsx index 63dfc9300..176c1cfa9 100644 --- a/packages/jupyter-ai/src/components/rendermime-markdown.tsx +++ b/packages/jupyter-ai/src/components/rendermime-markdown.tsx @@ -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 {