-
Notifications
You must be signed in to change notification settings - Fork 299
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
Generate a single sidebar HTML file and insert it into each page in an iframe #762
Comments
I think a challenge that you're going to run into here is that the relative links will change for each page (Sphinx makes all of its cross-reference links relative to the current document). For example, here's an example of a link in the header: <a class="reference internal nav-link" href="../demo/index.html">
Demo site
</a> So to define a single HTML structure you'd need to either hard-code absolute paths in the links (which I don't think is possible in Sphinx), or you'd need to ensure that your documentation is all in a single folder so that relative paths are the same everywhere. |
Good point! We would be happy to flatten the output into one folder. I'm not familiar enough with sphinx to know whether that can/should be done by the theme, or if we will need a pre-processing step e.g. in an extension. Alternatively, for our use case, we could possibly set an absolute path as the Playing around a bit, it looks like a block like |
My feeling is that re-working this theme to embed an That could then replace the pydata sphinx theme sidebar in its entirety and you could add whatever HTML mechanism you'd like. Then in your build That way you could have full flexibility over the sidebar. |
@gilbertbw did you had the time to check this solution ? |
As requested by @choldgraf here #364 (comment) I have pulled this comment #364 (comment) out into its own issue and clarified the proposal.
We are looking to use sphinx-book-theme to document our product, moving from a .chm file produced using Help and Manual. sphinx-book-theme is based off of pydata-sphinx-theme.
We have two issues with inserting the sidebar into every page:
alabaster
, to 10 minutes with sphinx-book-themeI have been discussing this on the sphinx-book-theme repo here executablebooks/sphinx-book-theme#561
Current Workaround
These issues seem to be reported by many users, currently the recommendation, here, is to reduce the number of pages in the sidebar. This is not a good solution for us, as want the UX of being able to browse through the tree before moving page.
Proposal
Looking into this, I have come up with the following proposal (first discussed here executablebooks/sphinx-book-theme#561 (comment)):
Support outputting the sidebar once, into its own file, then including the sidebar with an
<iframe/>
in each page.To still show the relevant subsection of the tree on each page, without javascript:
generate_nav_tree
pydata-sphinx-theme/src/pydata_sphinx_theme/__init__.py
Line 155 in 26554f2
<li>
in the tree.<style>...</style>
to show the current page.<iframe>
? Not sure if the implementer of the theme should be responsible for this?I want to discuss how these changed would be received, before I open a PR.
Example
With a tree like this, where the class is on the
<li>
on the page
Top 1
addor on
Top 2 Child 3 Child 2
adde.t.c.
The text was updated successfully, but these errors were encountered: