我尝试在重构文本文件上添加可折叠部分,但我找不到一些支持材料。对于 Markdown 文本,它很简单:https://gist.github.com/pierrejoubert73/902cc94d79424356a8d20be2b382e1ab
致以诚挚的问候。
我建议您使用 Sphinx Design 扩展,它提供 dropdown 来完成您所要求的操作。
自版本 0.18 (2021-10-26) 起,Docutils 的 HTML5 编写器原生支持详细信息披露元素。上面链接中的示例生成自:
.. class:: details
A summary
with details only visible after user interaction.
.. class:: details open
Another summary
with open details because the source list has the additional class
value "open".