【问题标题】:Can I add a horizontal bar to a table of contents in Sphinx?我可以在 Sphinx 的目录中添加水平条吗?
【发布时间】:2020-04-29 13:28:07
【问题描述】:

我正在使用 Sphinx 开发文档,并希望使用水平条分隔目录中的部分。

我经常在菜单中看到这个:

有没有办法在 sphinx 中做到这一点?

【问题讨论】:

    标签: python python-sphinx horizontal-line toctree


    【解决方案1】:

    python sphinx .. toctree:: 指令除了包含在指令正文中的文档以及一些指令选项外,不允许有太多变化。

    我看到其他人在这种情况下所做的是将一个 toctree 拆分为多个,包括它们之间的 reStructuredText。

    您可以使用toctree 的替代方法。引用文档:

    注意

    对于本地目录,请使用标准 reST contents directive

    最简单的方法是将菜单分成几个toctrees,包括它们之间的HTML水平标尺:

    Sphinx_test
    ===========
    
    
    .. toctree::
       :maxdepth: 4
       
       undo
       redo
    
    .. raw:: html
    
       <hr>
    
    .. toctree::
       :maxdepth: 4
       
       cut
       copy
    
    .. raw:: html
    
       <hr>
       
    .. toctree::
       :maxdepth: 4
          
       find
       Speech
    

    结果:

    【讨论】:

      猜你喜欢
      • 2022-11-18
      • 2015-11-11
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      相关资源
      最近更新 更多