Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: support both $$ and $ latex format (#5723)

Nam Vu9513155fa46b
diff --git a/web/app/components/base/markdown.tsx b/web/app/components/base/markdown.tsx
index 37d9ad691d2..14a630b2ed7 100644
--- a/web/app/components/base/markdown.tsx
+++ b/web/app/components/base/markdown.tsx
@@ -44,7 +44,8 @@ const preprocessLaTeX = (content: string) => {
if (typeof content !== 'string')
return content
return content.replace(/\\\[(.*?)\\\]/gs, (_, equation) => `$$${equation}$$`)
- .replace(/\\\((.*?)\\\)/gs, (_, equation) => `$${equation}$`)
+ .replace(/\\\((.*?)\\\)/gs, (_, equation) => `$$${equation}$$`)
+ .replace(/(^|[^\\])\$(.+?)\$/gs, (_, prefix, equation) => `${prefix}$${equation}$`)
}
export function PreCode(props: { children: any }) {