I finally got around to looking into the source code myself to fix this. For the record, here's my solution (the final commit in this PR): https://github.com/dylan-lang/sphinx-extensions/issues/23
Thanks to whichever Sphinx dev wrote the long comments on the _toc_entry_name method and related methods. -Carl On Monday, June 12, 2023 at 3:47:18 PM UTC-4 Carl Gay wrote: > Hi, I'm using a custom domain > <https://github.com/dylan-lang/sphinx-extensions/tree/master/sphinxcontrib/dylan/domain> > > for the Dylan programming language and I would like to include all the > functions, constants, etc defined with directives in the table of contents > at the correct level. Is it possible to have the domain directives > themselves add entries to the toctree? > > From what I know so far, I'm thinking that I should be able to introspect > the generated object graph to figure out the current ToC depth and > (somehow) insert nodes at the next level. To be a little more concrete, if > my document looks like this: > > My Library > ********** > > My Module 1 > =========== > > .. function:: foo > > foo is ferocious > > My Module 2 > =========== > > .. constant:: bar > > bar is best > > I would like to see this table of contents in the right sidebar (I'm using > the Furo <https://pradyunsg.me/furo/> theme, if it's important): > > My Module 1 > foo > My Module 2 > bar > > I'm hoping that someone can tell me whether I'm heading in the right > direction by trying to do this with the Dylan domain code, or if I need to > look at some other way to accomplish it, so that I don't spend too much > time going down the wrong path. > > Thanks. > -- 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 sphinx-users+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/sphinx-users/d8ca3359-5dbf-4ad0-b385-b5507ac7150cn%40googlegroups.com.