From c60b13b2dd7f4802477791cdefd7312632aecd45 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Wed, 7 Oct 2026 11:23:27 -0700 Subject: [PATCH] fix(markup): display MathML has no space below it (#39663) (#39668) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport #39663 by @nschloe Since MathML is allowed in markup (#36352, #38034, #39337), a display-style `` sits flush against the text below it: it gets no margin of its own, and markup paragraphs have `margin-top: 0`. Display math rendered by KaTeX gets 16px above and below. This adds `math[display="block"]` to the markup block elements that get `margin-top: 0; margin-bottom: 16px`, like `p`, `pre` and `table`. To test, view a Markdown file containing ```markdown Text before. x=1 Text after. ``` Before, the equation has 16px above and 0px below; after, 16px on both sides. Before: before After: after 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Nico Schlömer Co-authored-by: silverwind --- web_src/css/markup/content.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web_src/css/markup/content.css b/web_src/css/markup/content.css index 63f7a1986fc..7ed89eea98b 100644 --- a/web_src/css/markup/content.css +++ b/web_src/css/markup/content.css @@ -125,7 +125,8 @@ .markup ol, .markup dl, .markup table, -.markup pre { +.markup pre, +.markup math[display="block" i] { margin-top: 0; margin-bottom: 16px; }