From 1dd91a407bc503cb8d1ed7a1e93fafcf525e82bf Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sat, 31 Jan 2026 18:06:27 -0700 Subject: [PATCH] fix(math): add KaTeX CDN and fallback for radical SVG overflow KaTeX renders square roots using a 400em-wide SVG that relies on CSS `overflow: hidden` to clip to the correct length. Without the KaTeX stylesheet, this SVG extends across the entire page. Changes: - Add KaTeX CDN stylesheet link to base.html for fonts and layout - Add .katex-display local margin/overflow overrides - Add .hide-tail svg max-width fallback for file:// CORS blocking The CDN provides full KaTeX styling when accessible. The SVG constraint serves as a fallback when CDN is blocked (e.g., local file:// access). --- docs/static/style.css | 11 +++++++++++ docs/templates/base.html | 1 + 2 files changed, 12 insertions(+) diff --git a/docs/static/style.css b/docs/static/style.css index 59df8f6..340b021 100644 --- a/docs/static/style.css +++ b/docs/static/style.css @@ -127,6 +127,17 @@ a:hover { color: var(--accent-hover); } +/* KaTeX display math - local overrides */ +.katex-display { + margin: 1rem 0; + overflow-x: auto; +} + +/* Fallback: constrain radical SVG when CDN blocked */ +.hide-tail svg { + max-width: 100% !important; +} + /* Code */ code { font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace; diff --git a/docs/templates/base.html b/docs/templates/base.html index 60f9c21..fdfed52 100644 --- a/docs/templates/base.html +++ b/docs/templates/base.html @@ -7,6 +7,7 @@ {{ title }} | {{ config.title }} +