-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add class option to toctree directive #12524
Conversation
This is a common option for directives (https://docutils.sourceforge.io/docs/ref/rst/directives.html#common-options). Implementation detail: The class is added to there `toctree-wrapper` element, so that ``` .. toctree:: :class: some-class ``` is equivalent to ``` .. rst-class:: some-class .. toctree:: ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, my only reservation would be adding the class to toctree-wrapper
instead of the actual node.
A
text = (".. toctree::\n" | ||
" :class: custom-toc\n" | ||
"\n" | ||
" foo\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text = (".. toctree::\n" | |
" :class: custom-toc\n" | |
"\n" | |
" foo\n") | |
text = ('.. toctree::\n' | |
' :class: custom-toc\n' | |
'\n' | |
' foo\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. But note that all neighboring examples use double quotes.
My reasoning was
But if you say the actual node should be used, I can change that. I don't have enough insight why the wrapper is there and whether it should be considered or skipped. |
Seems that it was added in #129, see https://www.sphinx-doc.org/en/master/changes.html#id3196 (fifth bullet under "HTML output"). Regardless, I think your logic makes sense. A |
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Thanks Tim! A |
This is a common option for directives (https://docutils.sourceforge.io/docs/ref/rst/directives.html#common-options).
Implementation: The class is added to there
toctree-wrapper
element, so thatis equivalent to