From 4694b5e8ada04b0bce9df3165e58914cb75e5b85 Mon Sep 17 00:00:00 2001 From: PathGao <42336971+PathGao@users.noreply.github.com> Date: Wed, 2 Sep 2026 09:00:35 +0800 Subject: [PATCH] fix(preview): the label on an mhchem arrow is no longer clipped MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .katex-display hides vertical overflow so a wide formula's horizontal scrollbar does not bring a vertical one. KaTeX sizes the block from its own font metrics and has none for CJK, so the label in ->[燃烧] drew taller than the box and lost its top. Padding gives the headroom; the margin gives it back, so spacing to neighbours is unchanged. --- src/styles.css | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/styles.css b/src/styles.css index 450f6816..9f575b63 100644 --- a/src/styles.css +++ b/src/styles.css @@ -176,7 +176,14 @@ body { /* KaTeX Adjustment */ .katex-display { - margin: 1.5em 0 !important; + /* `overflow-y: hidden` keeps a wide formula's horizontal scrollbar from + bringing a vertical one, but it also clips at the padding edge. KaTeX + sizes the block from its own font metrics, and a glyph it has no metrics + for — the CJK label on an mhchem arrow, `->[燃烧]` — draws taller than + the box, so its top was cut off. The padding is that headroom; the margin + gives it back, so the block still sits 1.5em from its neighbours. */ + margin: 1.1em 0 !important; + padding: 0.4em 0; overflow-x: auto; overflow-y: hidden; text-align: center;