-
Notifications
You must be signed in to change notification settings - Fork 32
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
Adding links to the index (genindex) and module index to the navigation sidebar #132
Comments
Yes, replacing the entire In general the index seems redundant with the search functionality, but I suppose some may still prefer to have it. |
I'm guessing you want a customizable block that can be more easily overridden in the layout.html template. While that would be sufficient, it may cause merge conflicts with updates from mkdocs-material src. We try not to deviate too much from the mkdocs-material templates, and I don't see this customizable block as something that would be useful for mkdocs-material. I understand your concern though, if upstream changes it's layout.html template, then you'd undoubtedly have to update your custom solution to match -> not very sustainable.
It's not redundant if you don't know what to type in the search. Rather, its beneficial to new readers (or those that don't fluently read the docs' language). |
From this StackOverflow answer you can do this by adding
.. toctree::
page1.rst
page2.rst
genindex
Index
===== I did this in my repo.
|
I'll look into this.
Please don't underestimate the usefulness of a handcrafted index! While the search function will yield all occurrences of a word, a good index will only reference the most useful uses. |
Thanks for the suggestion. I did stumble upon that SO question, but I didn't want to go down that route since it is explicitly discouraged. |
I think currently the search functionality does not make use of manual |
I was able to adjust Sphinx to accept I only want the Indices toctree in my HTML output, so I placed it inside an only directive. Unfortunately, sphinx-immateraterial crashes on it:
|
@brechtm Could post the result from a verbose build log ( |
PS. PR submitted with Sphinx: sphinx-doc/sphinx#10673 |
I just noticed that the HTML page titles for the general index and the module index say "None". sphinx-immaterial doesn't provide a search.html, so there's not issue there :-) |
It would seem that the generation of index needs some tweaking. I played around a bit with sphinx-immaterial/sphinx_immaterial/nav_adapt.py Lines 714 to 719 in 8dd1888
but the index.html doesn't have a ToC to extract the title from.
yeah the utility of search.html is integrated into all pages, so it isn't generated for this theme.
I'm only guessing here, but I think the theme's custom toc visitor needs to compensate for the FWIW, we really only aim to support HTML builders right now. We have limited latex builder support, but it is flawed (particularly for references IIRC). |
Starting to investigate, I added the following method to _TocVisitor:
I expected this to simply drop the toctree contained within the only directive, but it doesn't. I don't know why, but it seems that is all that is needed to support the only directive. 🤷 (EDIT:
At first, I didn't understand why you explicitly mention that a HTML theme would only support HTML builders, but then I noticed that sphinx-immaterial also brings some of the mkdocs features (document elements) over to Sphinx. Nice! I suppose that is what you are referring to? I'm personally not using any of these features (yet), so it would be nice if I could use sphinx-immaterial for HTML output and rinohtype for PDF output. |
If by "document elements" you mean things like customizable checkboxes, content tabs, mermaid diagrams, and etc, then yes, that's what I was referring to. At first I had RTD generating PDFs from this theme's docs using sphinx's latex builder, but this had to stop because the conversion from latex output to PDF was failing (again I think it was about cross references). I think it would be prudent to keep testing your
I'm not entirely familiar with your rinohtype lib - it seems enticing. In the past, I've used rst2pdf (which includes a custom sphinx builder), but they haven't been keeping up with Sphinx updates (their dev cycle is very slow - like bi-annual releases slow). |
This addresses one issue noted in #132 although due to Sphinx bug sphinx-doc/sphinx#9819 it is still not possible to use only directives to selectively include `genindex` and `modindex` in the global TOC.
This addresses one issue noted in #132 although due to Sphinx bug sphinx-doc/sphinx#9819 it is still not possible to use only directives to selectively include `genindex` and `modindex` in the global TOC.
This addresses one issue noted in #132 although due to Sphinx bug sphinx-doc/sphinx#9819 it is still not possible to use only directives to selectively include `genindex` and `modindex` in the global TOC.
This addresses one issue noted in #132 although due to Sphinx bug sphinx-doc/sphinx#9819 it is still not possible to use only directives to selectively include `genindex` and `modindex` in the global TOC.
Update: I've managed to migrate from the RTD theme to Sphinx-Immaterial by using my Sphinx PR branch (sphinx-doc/sphinx#10673) and some Sphinx-Immaterial monkey-patching and CSS tweaking. I love the look and absolutely adore the live search results. Thanks! You can see the result here: http://www.mos6581.org/rinohtype/master/ |
@2bndy5 Thanks for letting me know! I didn't check the narrow version. Fixed now. |
Is the |
Nope, it isn't. I didn't realize this fix was already available in 0.8.1. |
I'm currently using the RTD Sphinx theme, for which I've added templates to add links to these indices the the TOC as described in this StackOverflow answer. See the Indices and tables section in the sidebar at http://www.mos6581.org/rinohtype/0.5.4/ for the result.
I've been trying to do the same in sphinx-immaterial, but the templates do not seem to define blocks where these can easily be injected. My knowledge of Jinja is limited, but I think it is necessary to replace all of the
site_nav
block in layout.html, duplicating all of the block's contents and injecting the links. Here is my attempt so far:_templates/layout.html
This produces a this suboptimal result:
I was hoping there is a better way to approach this.
Actually, I think a better fix would be for Sphinx to allow including these indices in a toctree. Or perhaps sphinx-immaterial could provide an option to insert links to the indices at the bottom of the navigation tree?
The text was updated successfully, but these errors were encountered: