Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6a5f30c
docs(style[toc,body]): refine right-panel TOC and body typography
tony Mar 14, 2026
b85cb5a
docs(style[toc,content]): flexible TOC width with inner-panel padding
tony Mar 14, 2026
a412604
docs(style[toc]): increase TOC font size from 81.25% to 87.5%
tony Mar 14, 2026
693a880
docs(style[headings]): refine heading hierarchy — scale, spacing, eye…
tony Mar 14, 2026
9c45202
docs(fonts): self-host IBM Plex via Fontsource CDN
tony Mar 14, 2026
98d2e0f
docs(fonts[css]): fix variable specificity — use body instead of :root
tony Mar 14, 2026
2c560c4
docs(fonts[preload]): add <link rel="preload"> for critical font weights
tony Mar 14, 2026
b9e8b6f
docs(fonts[css]): add kerning, ligatures, and code rendering overrides
tony Mar 14, 2026
f83b0cb
docs(images[cls]): prevent layout shift and add non-blocking loading
tony Mar 14, 2026
b3a0481
docs(nav[spa]): add SPA-like navigation to avoid full page reloads
tony Mar 14, 2026
ccab059
docs(fonts[fallback]): add fallback font metrics to eliminate FOUT re…
tony Mar 14, 2026
36ead8f
docs(images[badges]): add placeholder sizing for external badge images
tony Mar 14, 2026
c67cb99
docs(sidebar[projects]): prevent active link flash with visibility gate
tony Mar 14, 2026
006a281
docs(nav[spa]): wrap DOM swap in View Transitions API for smooth cros…
tony Mar 14, 2026
7fede09
docs(css[structure]): move view transitions section after image rules
tony Mar 14, 2026
0fa6520
docs(fonts[loading]): switch to font-display block with inline CSS
tony Mar 14, 2026
f128bf2
docs(fonts[lint]): add docstrings to sphinx_fonts extension
tony Mar 14, 2026
09b5b2f
test(docs[sphinx_fonts]): add tests for sphinx_fonts extension
tony Mar 14, 2026
5d37f93
test(docs[sphinx_fonts]): fix ruff lint errors in test_sphinx_fonts
tony Mar 14, 2026
2e5f1ad
test(docs[sphinx_fonts]): apply ruff format to test_sphinx_fonts
tony Mar 14, 2026
2f458a7
test(docs[sphinx_fonts]): fix mypy errors in test_sphinx_fonts
tony Mar 14, 2026
8def325
pyproject(mypy): add sphinx_fonts to ignore_missing_imports
tony Mar 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
pyproject(mypy): add sphinx_fonts to ignore_missing_imports
why: sphinx_fonts is a local docs/_ext extension, not an installed
package — mypy cannot resolve it at analysis time.
what:
- Add sphinx_fonts to [[tool.mypy.overrides]] ignore_missing_imports
- Add targeted arg-type disable for test_sphinx_fonts (SimpleNamespace stubs)
  • Loading branch information
tony committed Mar 14, 2026
commit 8def3253f1e2426196894456a8b72700717d858f
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ files = [
"tests",
]

[[tool.mypy.overrides]]
module = ["sphinx_fonts"]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = ["tests.docs._ext.test_sphinx_fonts"]
disable_error_code = ["arg-type"]

[tool.coverage.run]
branch = true
parallel = true
Expand Down
26 changes: 23 additions & 3 deletions tests/docs/_ext/test_sphinx_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,27 @@ def fake_urlretrieve(url: str, filename: t.Any) -> t.NoReturn:
assert any("failed" in r.message for r in warning_records)


def test_download_font_partial_file_cleanup(
tmp_path: pathlib.Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""_download_font removes partial file on failure."""
dest = tmp_path / "cache" / "partial.woff2"

msg = "disk full"

def fake_urlretrieve(url: str, filename: t.Any) -> t.NoReturn:
pathlib.Path(filename).write_bytes(b"partial")
raise OSError(msg)

monkeypatch.setattr("sphinx_fonts.urllib.request.urlretrieve", fake_urlretrieve)

result = sphinx_fonts._download_font("https://example.com/font.woff2", dest)

assert result is False
assert not dest.exists()


# --- _on_builder_inited tests ---


Expand Down Expand Up @@ -262,7 +283,7 @@ def test_on_builder_inited_download_failure(
tmp_path: pathlib.Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""_on_builder_inited still builds font_faces entry on download failure."""
"""_on_builder_inited skips font_faces entry on download failure."""
monkeypatch.setattr("sphinx_fonts._cache_dir", lambda: tmp_path / "cache")

msg = "offline"
Expand All @@ -285,8 +306,7 @@ def fake_urlretrieve(url: str, filename: t.Any) -> t.NoReturn:

sphinx_fonts._on_builder_inited(app)

assert len(app._font_faces) == 1
assert app._font_faces[0]["family"] == "Inter"
assert len(app._font_faces) == 0


def test_on_builder_inited_explicit_subset(
Expand Down
Loading