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
2026-05-18 15:12:27 +08:00
committed by Xubin Ren
parent ba38f90832
commit 28d0f8560e
3 changed files with 8 additions and 1 deletions
@@ -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];
/**