Replacing sphinx-external-toc
with a custom Python script
#715
Unanswered
michaelosthege
asked this question in
Q&A
Replies: 1 comment
-
Heya @michaelosthege, if you are wishing to fully replace Simply run Then you could fork https://github.com/executablebooks/sphinx-external-toc and play around with extending/modifying it in some way, to resolve your needs. (same for sphinx_multitoc_numbering) Then, hopefully, when you have some working modifications, you can propose them on the main branch. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Motivation
Before I can fully commit to writing with Jupyter book, I need to resolve the most important blocker which is the overall composition of a scientific article:
(rendered with pdflatex)
Status
At this point I fiddled with
_toc.yml
for an accumulated >16 hours, but I have not tamed it to solve any of the above points.jb-book
format I couldn't get rid of "Chapter"s.jb-article
I run into jb-articles contains no top level headings jupyter-book/jupyter-book#1552hidden: true
setting did not have an effect.numbered: false
setting did not have an effect (withsphinx-multitoc-numbering
in_config.yml/sphinx/config/extra_extensions
)jb-book based _toc.yml
jb-article based _toc.yml
raw _toc.yml with extra settings
I wouldn't be surprised if some settings in the above YAML don't have an effect because I put them in the wrong place or indentation..
Procedure
My ToC experience is probably best described as performing a minimally invasive surgery without a camera:
Trying to control the
sphinx_external_toc.api.SiteMap
andsphinx.environment.Buildenvironment.toc_secnumbers
by writing a YAML file whichjb
parses as a specialformat
, maps it onto another YAML "schema" which is again parsed into aSiteMap
.And somehow the
numbered
settings must survive that procedure such thatsphinx-multitoc-numbering
can know how to do the numbering.Did I grasp that correctly?
Question
(How) can I do a
jb build
without going through the YAML bottleneck?For example, instead of
_toc.yml
+sphinx-external-toc
+sphinx-multitoc-numbering
, I would prefer to write atoc.py
.There I could
import sphinx_external_toc, sphinx_multitoc_numbering
and create theSiteMap
directly.Also the partial numbering could then be achieved with a simple exclusion list, right?
Beta Was this translation helpful? Give feedback.
All reactions