Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add version warning bar #1335

Closed
wants to merge 6 commits into from

Conversation

drammock
Copy link
Collaborator

@drammock drammock commented May 25, 2023

This PR adds an optional specialized announcement banner to warn users who are viewing versions of the docs other than the latest stable release. It can coexist with the generic announcement banner (it gets stacked above it) and is styled similarly except that it has the "danger" background color. Screenshot:

Screenshot 2023-05-24 at 17-16-20 The PyData Sphinx Theme — PyData Theme 0 13 4dev0 documentation

  • requires new node dependency https://www.npmjs.com/package/compare-versions to compare version strings
  • relies on the presence of the version switcher to know what the latest stable release is
  • enabled in conf.py / html_context
  • message adapts depending on whether viewed docs are an old version / the dev version

crossref: scientific-python/summit-2023#10 (comment)

@12rambau
Copy link
Collaborator

have ypu checked the main comments of this thread #780 ?

Copy link
Collaborator

@12rambau 12rambau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the code, I love it.

I first thought about the situation where one would use the "latest" version as a "stable" but you just need to set "stable" as a name in the switcher json to make it work. Also setting a different name in the conf.py file couldn't be used in a js compiled code.

Just to make sure, this will only work starting from the next version of the theme ? any previous version won't be able to show it ?

PS: the extra button can be coded in a follow-up PR

@drammock drammock marked this pull request as draft June 8, 2023 21:26
@drammock drammock mentioned this pull request Jun 20, 2023
@drammock drammock deleted the add-version-warning-bar branch August 1, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants