In case anyone else runs into this problem, I was able to fix both problems by 
making a one line change to the htmlhelp builder.

In <PythonRoot>\Lib\site-packages\sphinx\builders\htmlhelp.py, just before the 
definition of the write_toc function, change the function call:

  tocdoc = self.env.get_and_resolve_doctree(
                self.config.master_doc, self, prune_toctrees=False)

to:

  tocdoc = self.env.get_and_resolve_doctree(
                self.config.master_doc, self, prune_toctrees=True, 
includehidden=True)

This is in the code that generates the hhc file, which is what populates the 
contents pane in the html help viewer. Setting the prune_toctrees parameter to 
true limits the TOC to the maxdepth setting. Adding the includehidden parameter 
keeps hidden entries in the TOC.

I don't know whether this should be considered a bug or not. In my use case, 
this is the desired behavior. Also, it mimics what the default navigation 
side-bar does in html output. But the alabaster theme, at least, has the option 
sidebar_includehidden, which lets you either include or not include hidden 
entries in the navigation side-bar. There is a similar epub_tocscope config 
option that lets you control this for epub output. So there probably should be 
an option for this in the htmlhelp output, rather than making a fixed change.

Chris



-------- Original Message --------
Subject: [sphinx-users] TOC in HtmlHelp format
From: ChrisD <[email protected]>
To: [email protected]
Date: 2/24/2016 10:19 AM

I am trying to build HtmlHelp format output. I have a couple of problems with 
the table of contents.

I want the TOC to appear in the contents pane (left pane) of the htmlhelp 
viewer, but I do not want a TOC to appear in the text pane (since it already 
appears in the contents pane). If I set the :hidden: option on the toctree 
directive, the TOC does not appear in the text pane, but the contents pane has 
only a single entry with the title, none of the normal TOC appears. If I do not 
set the :hidden: option, the TOC is fully populated in the contents pane, but 
of course the TOC now also appears as links in the text pane. Is there any way 
to have a normal contents pane, but not repeat the TOC in the text pane?

When I do not hide the TOC, the TOC in the contents pane does not seem to 
respect the :maxdepth: option on the toctree directive. The contents pane TOC 
includes all levels of headings. The TOC in the text pane does respect the 
:maxdepth: option, but of course I want to get rid of the TOC in the text pane 
anyway.

Thanks,
Chris


--
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to