From 5bfbb0849f98179d3edca379d3718b874ac12643 Mon Sep 17 00:00:00 2001 From: Nacai <111849193+B67687@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:56:39 +0800 Subject: [PATCH] Improve notebook text contrast on GitHub Pages --- build_pages.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/build_pages.py b/build_pages.py index cdfa5a6..bde9872 100644 --- a/build_pages.py +++ b/build_pages.py @@ -32,6 +32,62 @@ ".yaml", } +NOTEBOOK_THEME_OVERRIDES = """ + +""" + def should_skip(path: Path) -> bool: return any(part in EXCLUDED_PARTS for part in path.parts) @@ -77,6 +133,8 @@ def rewrite_notebook_links(text: str) -> str: def rewrite_html_links(html_path: Path) -> None: content = html_path.read_text(encoding="utf-8") updated = rewrite_notebook_links(content) + if NOTEBOOK_THEME_OVERRIDES not in updated and "" in updated: + updated = updated.replace("", f"{NOTEBOOK_THEME_OVERRIDES}\n", 1) if updated != content: html_path.write_text(updated, encoding="utf-8")