From 4588850572741786552c56e76e0c9885c614d8dd Mon Sep 17 00:00:00 2001 From: 134 Date: Tue, 23 Jun 2026 23:45:47 +0800 Subject: [PATCH] fix: cap markdown heading sizes --- components/elements/response.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/elements/response.tsx b/components/elements/response.tsx index 1eebc685b..1cfdfdf63 100644 --- a/components/elements/response.tsx +++ b/components/elements/response.tsx @@ -37,6 +37,13 @@ const AGENT_SECTION_TITLES = new Set([ "优化后提示词", "输出设置", ]); +const MARKDOWN_HEADING_CLASS_NAME = + "[&_h1]:!mb-3 [&_h1]:!mt-4 [&_h1]:!text-[26px] [&_h1]:!font-semibold [&_h1]:!leading-[1.25] [&_h1]:!tracking-normal " + + "[&_h2]:!mb-2.5 [&_h2]:!mt-4 [&_h2]:!text-[22px] [&_h2]:!font-semibold [&_h2]:!leading-[1.3] [&_h2]:!tracking-normal " + + "[&_h3]:!mb-2 [&_h3]:!mt-3 [&_h3]:!text-[18px] [&_h3]:!font-semibold [&_h3]:!leading-[1.35] [&_h3]:!tracking-normal " + + "[&_h4]:!mb-1.5 [&_h4]:!mt-3 [&_h4]:!text-[16px] [&_h4]:!font-semibold [&_h4]:!leading-[1.4] [&_h4]:!tracking-normal " + + "[&_h5]:!text-[15px] [&_h5]:!font-semibold [&_h5]:!leading-[1.4] [&_h5]:!tracking-normal " + + "[&_h6]:!text-[14px] [&_h6]:!font-semibold [&_h6]:!leading-[1.4] [&_h6]:!tracking-normal"; type AnalysisSection = { before: string; @@ -330,6 +337,7 @@ export const Response = ({ const streamdownClassName = cn( "w-full min-w-0 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_code]:break-words [&_pre]:max-w-full [&_pre]:overflow-x-auto", className, + MARKDOWN_HEADING_CLASS_NAME, "whitespace-normal [&_code]:whitespace-pre-wrap" ); const processingKey = `${isProcessingEnhance}-${isProcessingRmbg}-${isProcessingExtend}-${isProcessingAngleEdit}-${isProcessingWatermarkRemove}`;