Commit c20339c4 by luoqi

fix(助手): 标题与正文的缝收窄 —— 外边距折叠把它撑成了段间距

标题 `mb` 6px 与紧随其后那段的 `mt` 14px **折叠成较大的那个**,
于是"标题正文"的缝跟"段段"一样宽,标题看着浮在半空。
⇒ 容器加 `[&_hN+*]:mt-1.5`,只压**紧跟标题**的那个块;段与段仍是 14px。
 别改 p 的 my 去凑 —— 那会把所有段落间距一起缩掉,段落又不成块了。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
parent 251f27d3
...@@ -120,8 +120,15 @@ function toolMeta(tool: string) { ...@@ -120,8 +120,15 @@ function toolMeta(tool: string) {
* (见 assistant-prompts 的「怎么写」一节)。 * (见 assistant-prompts 的「怎么写」一节)。
*/ */
function Markdown({ text }: { text: string }) { function Markdown({ text }: { text: string }) {
/**
* ⚠️ 容器上那三条 `[&_hN+*]:mt-1.5` 不是装饰,是**外边距折叠**的必然结果:
* 标题的 `mb`(6px)与紧随其后那一段的 `mt`(14px)会**折叠成较大的那个** ——
* 于是"标题↔正文"的缝跟"段↔段"一样宽,标题看着像浮在半空(产品指出来的那处)。
* ⇒ 只把**紧跟标题**的那个块的上边距压到 6px;段与段之间仍是 14px。
* ⛔ 别改 `p` 的 my 去凑:那会把所有段落的间距一起缩掉,段落又不成块了。
*/
return ( return (
<div className="text-[13.5px] leading-relaxed text-slate-700 [font-variant-numeric:tabular-nums]"> <div className="text-[13.5px] leading-relaxed text-slate-700 [font-variant-numeric:tabular-nums] [&_h1+*]:mt-1.5 [&_h2+*]:mt-1.5 [&_h3+*]:mt-1.5">
<ReactMarkdown <ReactMarkdown
remarkPlugins={[remarkGfm]} remarkPlugins={[remarkGfm]}
components={{ components={{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment