Add version banner to docs#1355
Open
AdrianDAlessandro wants to merge 4 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1355 +/- ##
=======================================
Coverage 88.80% 88.80%
=======================================
Files 58 58
Lines 8516 8516
Branches 8516 8516
=======================================
Hits 7563 7563
Misses 640 640
Partials 313 313 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a version-aware warning banner to the mdBook documentation site so users can tell when they’re reading development docs vs older release docs, and introduces a “stable” docs build that avoids showing the “old version” warning.
Changes:
- Add
theme/header.hbswith CSS + JS to render a version banner based on the URL path. - Add a “Stable version” entry to the generated versions page.
- Update the old-docs build script to copy the current theme into release worktrees and to produce a
release/stable/copy of the latest release.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| theme/header.hbs | Adds the banner markup/styles/script to mdBook pages and offsets layout when the banner is shown. |
| docs/templates/versions.md.jinja | Adds a link to the new stable docs path. |
| docs/build_old_docs.py | Ensures old releases use the current theme and generates a stable docs directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+109
to
+111
| # Copy latest release into stable dir | ||
| if i == 0: | ||
| shutil.copytree(release_outdir, outdir / "stable") |
| } | ||
| </style> | ||
|
|
||
| <div id="version-banner"></div> |
11 tasks
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.
Description
This PR adds a banner to the docs as a warning for all non-stable versions of the docs. It includes an amber banner for the dev version and a red banner for old versions. There is no banner for the stable version.
This is achieved by including a
header.hbsfile, which is a html snippet that MdBook inserts into the generated docs. There is some CSS for stying the banner and some JavaScript to dynamically determine the contents of the banner depending on the version of the docs (determined by the url path). I relied on LLM agents for much of this component.I have added a stable version of the docs that is built alongside the "old" docs. This is simply a copy of the most recent release. One drawback is that the release corresponding to this stable one (currently v2.1.0) includes the red banner, whereas the stable one does not. This is slightly misleading.
I have also developed a version selector widget, but I have put that in a separate PR because it includes some more executive decisions that I have made about the docs.
Fixes #1188
Assisted-by: Claude Sonnet 4.6
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks