bokeh / bokeh

Interactive Data Visualization in the browser, from Python

Home Page:https://bokeh.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

activate pydata-sphinx-theme version banner

mosc9575 opened this issue · comments

Since bokeh 3.2.2 the version banner is broken and a JS error appears in the browser console. See

The error

Uncaught ReferenceError: $ is not defined
    <anonymous> https://docs.bokeh.org/en/3.2.2/_static/custom.js:11

is caused by

// Display a version warning banner if necessary
$(document).ready(function () {
const randid = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
$.getJSON('/switcher.json?v=' + randid , function (data) {
// old versions have a unified latest/x.y.z, things are split starting with 3.0
if (BOKEH_CURRENT_VERSION != data[1].version) {
let msg
if (data.findIndex((elt) => elt.version == BOKEH_CURRENT_VERSION) < 0 ) {
msg = "DEVELOPMENT / PRE-RELEASE"
} else {
msg = "PREVIOUS RELEASE"
}
const content = $('<div class="version-alert">This page is documentation for a ' + msg + ' version. For the latest release, go to <a href="https://docs.bokeh.org/en/latest/">https://docs.bokeh.org/en/latest/</a></div>')
$('#banner').append(content);
}
})
})

The pydata-sphinx-theme offers the opportunity to add a version banner. This was mentioned in #13789 (comment)

Just noting that I believe version warning banners are now built into the theme, so you could try using that and see if that removes > the error

https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/announcements.html#version-warning-banners

The goal of this issue should be to remove the custom solution, silence the JS error and activate the theme banner by pydata-sphinx-theme.