Skip to content

Commit 7d3d1dd

Browse files
committed
docs: fix the sidebar rule cascade and print scheme scoping
The section-label overrides tied the density rule on specificity and lost on source order, re-indenting labels; and the density padding also hit the md-nav__container wrapper (stock 0), double-indenting group rows that link to an index page. Order the density rules first and densify the container's inner anchor instead of the wrapper. The slate canvas override moves under @media screen like the stock rule it replaces, so dark-mode printing keeps a light canvas; stub titles gain YAML quoting.
1 parent 153d384 commit 7d3d1dd

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

docs/extra.css

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@
66
extra palette handling. */
77

88
@media screen and (min-width: 76.25em) {
9+
/* Tighten vertical rhythm: the stock pill rows (7px 16px padding plus
10+
6.3px top margins) read too airy for a deep nav; keep the pill shape
11+
and active highlight, just denser. Group rows that link to an index
12+
page wrap their anchor in an .md-nav__container div whose stock
13+
padding is 0 — densify the inner anchor, not the wrapper. The
14+
section-label rules below must come AFTER these: they win the
15+
specificity tie on source order. */
16+
.md-sidebar--primary .md-nav__item > .md-nav__link:not(.md-nav__container) {
17+
padding: 4px 10px;
18+
margin-top: 2px;
19+
}
20+
.md-sidebar--primary .md-nav__item > .md-nav__container {
21+
margin-top: 2px;
22+
}
23+
.md-sidebar--primary .md-nav__container > .md-nav__link {
24+
padding: 4px 10px;
25+
}
26+
.md-sidebar--primary .md-nav__item--section {
27+
margin: 1em 0;
28+
}
29+
930
/* Section labels: smaller, uppercase, letter-spaced, muted, and flush
1031
with the guide line below them. The label is a container whose inner
1132
anchor carries the stock pill padding; zero both so the label text
@@ -36,17 +57,6 @@
3657
border-inline-start: 0.05rem solid var(--md-default-fg-color--lightest);
3758
}
3859

39-
/* Tighten vertical rhythm: the stock pill rows (7px 16px padding plus
40-
6.3px top margins) read too airy for a deep nav; keep the pill shape
41-
and active highlight, just denser. */
42-
.md-sidebar--primary .md-nav__item > .md-nav__link {
43-
padding: 4px 10px;
44-
margin-top: 2px;
45-
}
46-
.md-sidebar--primary .md-nav__item--section {
47-
margin: 1em 0;
48-
}
49-
5060
/* The current page stands out from its siblings (on top of the stock
5161
pill highlight). 700 because only Inter 300/400/700 are loaded. */
5262
.md-sidebar--primary .md-nav__link--active {
@@ -64,8 +74,10 @@
6474
/* Dark scheme: Zensical's slate canvas is near-black (hsla(225,15%,5%)),
6575
harsher than the Material slate this site shipped with; restore that
6676
blue-grey. Code blocks and other surfaces keep Zensical's own tokens. */
67-
[data-md-color-scheme="slate"] {
68-
--md-default-bg-color: #1e2129;
77+
@media screen {
78+
[data-md-color-scheme="slate"] {
79+
--md-default-bg-color: #1e2129;
80+
}
6981
}
7082

7183
/* Headings: the 300-weight light-gray defaults read washed out; use the

scripts/docs/gen_ref_pages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def generate() -> list[NavItem]:
156156
# Explicit titles: the stubs have no H1 of their own, and a
157157
# title-less page falls back to "Index"/the filename — which is
158158
# what pruned nav rows, browser tabs, and search results show.
159-
stubs[API_DIR / doc_path] = f"---\ntitle: {parts[-1]}\n---\n\n::: {ident}\n"
159+
stubs[API_DIR / doc_path] = f'---\ntitle: "{parts[-1]}"\n---\n\n::: {ident}\n'
160160
if len(parts) == 1:
161161
package_index[ident] = API_DIR / doc_path
162162

@@ -173,7 +173,7 @@ def generate() -> list[NavItem]:
173173
module = modules[ident]
174174
assert isinstance(module, griffe.Module)
175175
if body := _compact_index(module, documented):
176-
stubs[doc_path] = f"---\ntitle: {ident}\n---\n\n{body}"
176+
stubs[doc_path] = f'---\ntitle: "{ident}"\n---\n\n{body}'
177177

178178
for full_doc_path, stub in stubs.items():
179179
full_doc_path.parent.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)