2026-01-30 16:41:18 +08:00
|
|
|
import rehypeKatex from "rehype-katex";
|
|
|
|
|
import remarkGfm from "remark-gfm";
|
|
|
|
|
import remarkMath from "remark-math";
|
|
|
|
|
import type { StreamdownProps } from "streamdown";
|
|
|
|
|
|
|
|
|
|
export const streamdownPlugins = {
|
|
|
|
|
remarkPlugins: [
|
2026-02-04 11:56:10 +08:00
|
|
|
remarkGfm,
|
|
|
|
|
[remarkMath, { singleDollarTextMath: true }],
|
2026-01-30 16:41:18 +08:00
|
|
|
] as StreamdownProps["remarkPlugins"],
|
|
|
|
|
rehypePlugins: [
|
|
|
|
|
[rehypeKatex, { output: "html" }],
|
|
|
|
|
] as StreamdownProps["rehypePlugins"],
|
|
|
|
|
};
|
2026-02-06 14:30:57 +08:00
|
|
|
|
|
|
|
|
// Plugins for human messages - no autolink to prevent URL bleeding into adjacent text
|
|
|
|
|
export const humanMessagePlugins = {
|
|
|
|
|
remarkPlugins: [
|
|
|
|
|
// Use remark-gfm without autolink literals by not including it
|
|
|
|
|
// Only include math support for human messages
|
|
|
|
|
[remarkMath, { singleDollarTextMath: true }],
|
|
|
|
|
] as StreamdownProps["remarkPlugins"],
|
|
|
|
|
rehypePlugins: [
|
|
|
|
|
[rehypeKatex, { output: "html" }],
|
|
|
|
|
] as StreamdownProps["rehypePlugins"],
|
|
|
|
|
};
|