sphinx-doc/sphinx

create table of contents entries for functions, classes, and methods

Phillip-M-Feldman opened this issue · 8 comments

I'd like to implement an option in Sphinx to create table-of-contents entries for all functions, classes, and methods, with method entries nested under the appropriate classes. I've been trying to figure out where I would make this change. When I look at https://github.com/sphinx-doc/sphinx/blob/master/sphinx/environment/adapters/toctree.py, it does seem to be manipulating the ToC tree, but I haven’t been able to identify any place where things are being inserted into the tree. Perhaps it is there and I’m just missing it. Any help will be appreciated.

lagru commented

I'm also interested in extending a custom directive with this functionality.

I found this interesting function and this snippet in the autosummary extension which seem related. But this seems to expect actual files as targets not the nodes corresponding to object descriptions.

Is this feature request? What is different with #6316?

lagru commented

@tk0miya Not necessarily. But I'd be happy about a few pointers to the steps that would be necessary. If I manage to do this and there is a general interest, I'd be happy to help with a PR for a similar feature.

I'm not sure how sphinx (or is it docutils) goes about constructing the TOC tree and how I would apply that knowledge to a custom directive. That directive works similar to ObjectDescription but will generate its own content for the content node. It is used to document commands of a console interface. However it would be nice if the signature of this documented object would then be visible in the TOC and displayable in the sidebar.

I wasn't even aware of that other issue.

I'd like to know the goal of this issue. This is issues list of Sphinx, not forum. So all issues should have the goal. If you'd like to discuss or talk about developing, please move to sphinx-devel list. If not, please let me know the goal of the issue.
https://groups.google.com/forum/#!forum/sphinx-dev

I believe that this is essentially the same as issue #6316. But, I never got a response to my request for advice as to how I can go about making that change, e.g., what modules and methods would have to be changed. I'm a bit surprised because I had expected the Sphinx team to jump on an offer for help.

Sorry for not response you on #6316. TBH, I don't know how to enhance TOC. So I could not answer to your question. I need to investigate our code to implement it...

So I guess this issue can be closed as duplicate of #6316?

jfbu commented

I am closing this as duplicate of #6316, feel free to re-open if you feel it is not duplicate.