doc: Make code-samples admonition collapsible
Use sphinx-toggle to make "Related code samples" collapsible. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
5832f6ed5f
commit
b2977b7657
3 changed files with 4 additions and 0 deletions
|
@ -142,7 +142,9 @@ class ProcessRelatedCodeSamplesNode(SphinxPostTransform):
|
|||
if len(code_samples) > 0:
|
||||
admonition = nodes.admonition()
|
||||
admonition += nodes.title(text="Related code samples")
|
||||
admonition["collapsible"] = "" # used by sphinx-immaterial theme
|
||||
admonition["classes"].append("related-code-samples")
|
||||
admonition["classes"].append("dropdown") # used by sphinx-togglebutton extension
|
||||
sample_ul = nodes.bullet_list()
|
||||
for code_sample in sorted(code_samples, key=lambda x: x["name"]):
|
||||
sample_para = nodes.paragraph()
|
||||
|
|
|
@ -84,6 +84,7 @@ extensions = [
|
|||
"zephyr.vcs_link",
|
||||
"notfound.extension",
|
||||
"sphinx_copybutton",
|
||||
"sphinx_togglebutton",
|
||||
"zephyr.external_content",
|
||||
"zephyr.domain",
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ sphinxcontrib-svg2pdfconverter
|
|||
pygments>=2.9
|
||||
sphinx-notfound-page
|
||||
sphinx-copybutton
|
||||
sphinx-togglebutton
|
||||
|
||||
# YAML validation. Used by zephyr_module.
|
||||
PyYAML>=5.1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue