-
Notifications
You must be signed in to change notification settings - Fork 12
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
80 focus lost in navbar #96
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
* renamed file * updated conf.py to load corresponding navbar js * Added comments Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
…if doxygen files are opened * Updated rtd theme options Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
if config.html_theme == "sphinx_book_theme": | ||
app.add_js_file("js/customize-navbar-book.js") | ||
|
||
elif config.html_theme == "sphinx_rtd_theme": | ||
app.add_js_file("js/customize-navbar-rtd.js") | ||
config.html_theme_options["collapse_navigation"] = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being nosey here, but could there be some kind of explicit option to get these files?
For ROCm documentation our theme is a slightly modified version of the Sphinx Book Theme (custom headers and footers), and I'm certain the js file for that theme would work for us as well, so it would be nice if we could enable this fix somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are planning to provide these files as part of an extension which will be part of Doxysphinx. So hopefully you won't need to add anything manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant is the current logic wouldn't work for us because config.html_theme
wouldn't be sphinx_rtd_theme
, so it would be good to have another way to enable this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Maetveis So you have an own version of the sphinx book theme with a different name, e.g. "sphinx-book-theme-custom" right? In that case as you said his extension won't do anything for you.
But you could still use the jsfile as it's in the doxysphinx-theme package directory.
Maybe a little bit cumbersome to reference though, however here's a rough sketch of the idea (untested!):
#<conf.py>
from pathlib import Path
from importlib.resources import files
# ...
patch_js_path = Path(files("doxysphinx_theme")) / "_static/js/customize-navbar-book.js"
html_theme_options = {
'extra_scripts': [str(patch_js_path)]
}
But this might be only working in python 3.11+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's exactly what we have.
I think I'll be able to make something like that work, the only slight issue with it is that I need to "know" implementation details of doxysphinx, I guess that is a price for having "forked" a theme.
I'll try this out and maybe do a PR if I come up with a way to have less coupling. Thank you for the help.
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Signed-off-by: Aniket Salve(XC-DX/EPG2) <[email protected]>
Added custom JS for rtd theme and books theme in order to maintain the last navigation state highlighted in navbar when doxygen files are opened