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).
This commit is contained in:
11
docs/static/style.css
vendored
11
docs/static/style.css
vendored
@@ -127,6 +127,17 @@ a:hover {
|
|||||||
color: var(--accent-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 */
|
||||||
code {
|
code {
|
||||||
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
|
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
|
||||||
|
|||||||
1
docs/templates/base.html
vendored
1
docs/templates/base.html
vendored
@@ -7,6 +7,7 @@
|
|||||||
<title>{{ title }} | {{ config.title }}</title>
|
<title>{{ title }} | {{ config.title }}</title>
|
||||||
<link rel="canonical" href="{{ base_url }}{{ page_path }}" />
|
<link rel="canonical" href="{{ base_url }}{{ page_path }}" />
|
||||||
<link rel="stylesheet" href="{{ prefix }}/style.css" />
|
<link rel="stylesheet" href="{{ prefix }}/style.css" />
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css" crossorigin="anonymous" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user