fix(docs): restore gp-sphinx FOWT prevention#527
Merged
Conversation
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
e49aaec to
8fb250d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #527 +/- ##
=======================================
Coverage 58.23% 58.23%
=======================================
Files 40 40
Lines 6489 6489
Branches 1098 1098
=======================================
Hits 3779 3779
Misses 2177 2177
Partials 533 533 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restores the inline
<script>that hides<body>until the resolved theme is applied — without it, the page renders with the default theme briefly before flipping to the user's preference, showing as a dark→light flash on light-theme loads.Root cause
docs/conf.pydefineddef setup(app)afterglobals().update(conf). Python module-namespace order means the user'ssetupsilently shadowed the onegp_sphinx.config.merge_sphinx_config()returns. With gp-sphinx'ssetupnever running, four hooks the theme relies on never registered:_inject_fowt_preventionhead-injection (the visible flicker bug)_inject_copybutton_bridgeselector scriptjs/spa-nav.jsSPA-navigation scriptremove_tabs_jsbuild-finished cleanupmyst/myst-mdPygments lexersFix
Mirror the chain pattern already in use at
vcspull/docs/conf.py: popconf["setup"]into_gp_setupbeforeglobals().update(conf), then call_gp_setup(app)as the first statement of the user'ssetup(app).Verification
Local
just build-docsproduces a<head>containing both:<style>html.gp-sphinx-theme-pending body:not([data-theme]){visibility:hidden}</style><script data-cfasync="false">(function(){var t=localStorage.getItem("theme")||"auto";...})()</script>These were absent from the live site before this PR. Grep proof on the local build:
gp-sphinx-theme-pendingcount goes from0→2.