Skip to content

Commit ec2e0b2

Browse files
committed
fix(docs[conf]) chain gp-sphinx setup() to restore FOWT prevention
why: docs/conf.py defined `def setup(app)` AFTER `globals().update(conf)`, which silently shadowed the `setup` callback `gp_sphinx.config.merge_sphinx_config()` returns. With gp-sphinx's setup never running, the inline `<script data-cfasync="false">` that gates body paint until `data-theme` is set was never injected — causing the dark→light flicker visible at load time. Mirrors the pop+chain pattern at vcspull/docs/conf.py. what: - pop `conf["setup"]` into `_gp_setup` before `globals().update(conf)` - call `_gp_setup(app)` as the first statement of the user's `setup(app)` so gp-sphinx's hooks register first side effects (all previously silently disabled, now restored): - `js/spa-nav.js` SPA-navigation script - GP_SPHINX_COPYBUTTON_SELECTOR bridge for sphinx-copybutton - `remove_tabs_js` build-finished cleanup - `myst` / `myst-md` Pygments lexers
1 parent ccde355 commit ec2e0b2

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

docs/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
html_extra_path=["manifest.json"],
6363
rediraffe_redirects="redirects.txt",
6464
)
65+
66+
_gp_setup = conf.pop("setup")
6567
globals().update(conf)
6668

6769

@@ -91,5 +93,14 @@ def _on_missing_class_reference(
9193

9294

9395
def setup(app: Sphinx) -> None:
94-
"""Connect missing-reference handler to resolve py:data as :class: links."""
96+
"""Chain gp-sphinx setup() and connect the missing-reference handler.
97+
98+
``_gp_setup`` is the callback ``gp_sphinx.config.merge_sphinx_config``
99+
returns; it registers the FOWT-prevention head injection,
100+
``spa-nav.js``, the copy-button bridge, the ``remove_tabs_js``
101+
cleanup, and the MyST Pygments lexers. Without this chain those
102+
hooks never register and the docs site flashes the wrong theme
103+
before settling on the user's preference.
104+
"""
105+
_gp_setup(app)
95106
app.connect("missing-reference", _on_missing_class_reference)

0 commit comments

Comments
 (0)