Files
Jyotisha/frontend/src/components/chat-markdown-view.tsx
T
Jesse_Chen e635c40224
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled
fix(consult): fold the technique audit out of the spoken answer
Keep comparative tables in chat, but hide the long audit behind a collapsed control so the reply stays readable.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 15:29:04 +08:00

32 lines
769 B
TypeScript

"use client";
import ReactMarkdown, { type Components } from "react-markdown";
import remarkGfm from "remark-gfm";
const markdownComponents: Components = {
a: ({ children, href, ...props }) => (
<a {...props} href={href} rel="noreferrer" target="_blank">
{children}
</a>
),
table: ({ children }) => (
<div className="markdown-table">
<table>{children}</table>
</div>
),
ul: ({ children }) => <ul className="markdown-list">{children}</ul>,
ol: ({ children }) => <ol className="markdown-list">{children}</ol>,
};
export function renderChatMarkdown(text: string) {
return (
<ReactMarkdown
components={markdownComponents}
remarkPlugins={[remarkGfm]}
skipHtml
>
{text}
</ReactMarkdown>
);
}