Skip to contentSkip to conversation

docs: fix the html docs search function

PATCH In review Volker Rümelin 2 participants 3 messages Jul 17, 2024 – Jul 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: fix the html docs search function

Fix the search function in Sphinx generated html docs when built with Sphinx >= 6.0.0.

Quote from the Sphinx blog at
https://blog.readthedocs.com/sphinx6-upgrade

Sphinx 6 is out and has important breaking changes

Bundled jQuery is removed. The JavaScript asset is easily added back using the new extension sphinxcontrib-jquery. It is included automatically by sphinx-rtd-theme, so if you are using our theme, you will also continue to have jQuery available in your documentation.

---
 docs/conf.py | 3 +++
 1 file changed, 3 insertions(+)
docs/conf.py +3 -0
index 876f676881..2aedd407a0 100644
@@ -62,6 +62,9 @@
 # ones.
 extensions = ['kerneldoc', 'qmp_lexer', 'hxtool', 'depfile', 'qapidoc']
 
+if sphinx.version_info[:3] >= (6, 0, 0):
+    extensions += ['sphinxcontrib.jquery']
+
 if sphinx.version_info[:3] > (4, 0, 0):
     tags.add('sphinx4')
     extensions += ['dbusdoc']
Signature · 1 line
2.35.3
#1 lore raw
Quoted 7 lines · Volker Rümelin

Fix the search function in Sphinx generated html docs when built with Sphinx >= 6.0.0.

Quote from the Sphinx blog at
https://blog.readthedocs.com/sphinx6-upgrade

Quoted 7 lines

Sphinx 6 is out and has important breaking changes

Bundled jQuery is removed. The JavaScript asset is easily added back using the new extension sphinxcontrib-jquery. It is included automatically by sphinx-rtd-theme, so if you are using our theme, you will also continue to have jQuery available in your documentation.

We do use the sphinx-rtd-theme, though:
html_theme = 'sphinx_rtd_theme'

so that release note suggests we shouldn't need to manually pull in sphinxcontrib-jquery ?

thanks
-- PMM

#2 lore raw

Am 18.07.24 um 11:17 schrieb Peter Maydell:

Quoted 14 lines · Volker Rümelin
Quoted 6 lines

Fix the search function in Sphinx generated html docs when built with Sphinx >= 6.0.0.

Quote from the Sphinx blog at
https://blog.readthedocs.com/sphinx6-upgrade

Quoted 7 lines

Sphinx 6 is out and has important breaking changes

Bundled jQuery is removed. The JavaScript asset is easily added back using the new extension sphinxcontrib-jquery. It is included automatically by sphinx-rtd-theme, so if you are using our theme, you will also continue to have jQuery available in your documentation.

Quoted 5 lines

We do use the sphinx-rtd-theme, though:
html_theme = 'sphinx_rtd_theme'

so that release note suggests we shouldn't need to manually pull in sphinxcontrib-jquery ?

You are right. I had a broken version of the sphinx_rtd_theme (version 1.2.0). This is a known issue and my patch is not necessary.

With best regards,
Volker

Quoted 3 lines

thanks
-- PMM