fix(webui): preserve single newlines in markdown rendering

Add remark-breaks plugin so that single newlines in assistant messages
(such as /help output) render as line breaks instead of being collapsed
into a single paragraph by standard markdown behavior.
This commit is contained in:
chengyongru authored and Xubin Ren committed 2026-05-18 15:12:27 +08:00
1 parent ba38f90832
commit 28d0f8560e
3 files changed
+8 -1

No files matched your search

@@ -2,6 +2,7 @@ import { Children, isValidElement, useMemo } from "react";
import type { Components } from "react-markdown";
import ReactMarkdown from "react-markdown";
import rehypeKatex from "rehype-katex";
import remarkBreaks from "remark-breaks";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
@@ -17,7 +18,7 @@ interface MarkdownTextRendererProps {
highlightCode?: boolean;
}
const remarkPlugins = [remarkGfm, remarkMath];
const remarkPlugins = [remarkBreaks, remarkGfm, remarkMath];
const rehypePlugins = [rehypeKatex];
/**