Fix Markdown table cell paragraph spacing

This commit is contained in:
Frank Song
2026-05-16 12:30:15 +08:00
committed by Hermes Agent
parent 59ffd573ae
commit 80be1d08dc
2 changed files with 21 additions and 0 deletions

View File

@@ -906,6 +906,7 @@
.role-icon.assistant{background:var(--accent-bg-strong);color:var(--accent-text);border:1px solid var(--accent-bg-strong);}
.msg-body{font-size:14px;line-height:1.75;color:var(--text);padding-left:30px;max-width:680px;overflow-wrap:anywhere;}
.msg-body p{margin-bottom:10px;}.msg-body p:last-child{margin-bottom:0;}
.msg-body td p,.msg-body th p{margin:0;}
.msg-body ul,.msg-body ol{margin:6px 0 10px 20px;}.msg-body li{margin-bottom:3px;}
.msg-body h1,.msg-body h2,.msg-body h3,.msg-body h4,.msg-body h5,.msg-body h6{font-weight:700;color:var(--strong,var(--text));line-height:1.3;}
.msg-body h1{font-size:24px;margin:24px 0 12px;border-bottom:1px solid var(--border);padding-bottom:6px;}

View File

@@ -0,0 +1,20 @@
"""Regression tests for Markdown table cell spacing."""
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
STYLE_CSS = (REPO_ROOT / "static" / "style.css").read_text(encoding="utf-8")
def test_table_cell_paragraph_margins_are_reset():
"""Paragraphs inserted inside Markdown table cells should not add extra row height."""
assert ".msg-body td p,.msg-body th p{margin:0;}" in STYLE_CSS
def test_table_cell_paragraph_reset_follows_global_message_paragraph_rule():
"""The table-specific reset must override the generic message paragraph spacing rule."""
generic_rule = ".msg-body p{margin-bottom:10px;}"
table_reset = ".msg-body td p,.msg-body th p{margin:0;}"
assert generic_rule in STYLE_CSS
assert STYLE_CSS.index(generic_rule) < STYLE_CSS.index(table_reset)