我可以在Sphinx目录中添加单杠吗? [英] Can I add a horizontal bar to a table of contents in Sphinx?

查看:105
本文介绍了我可以在Sphinx目录中添加单杠吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm developing documentation in Sphinx, and would like to separate sections in my table of contents using horizontal bars.

我经常在菜单中看到这一点:

I often see this in menus:

有没有办法在狮身人面像中做到这一点?

Is there a way to do it in sphinx?

推荐答案

python sphinx

The python sphinx .. toctree:: directive doesn't allow much variation besides the documents you include in the directive body, plus a few directive options.

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

What I've seen others do in this case is splitting one toctree into several, including reStructuredText in between them.

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

You could use an alternative to the toctree. Quoting the documentation:

注意

对于本地目录,请使用标准的reST contents指令.

For local tables of contents, use the standard reST contents directive.

最简单的方法是将菜单分为几个toctree,其中包括一个HTML水平标尺:

The easiest way is splitting the menu into several toctrees including a HTML horizontal ruler between them:

Sphinx_test
===========


.. toctree::
   :maxdepth: 4
   
   undo
   redo

.. raw:: html

   <hr>

.. toctree::
   :maxdepth: 4
   
   cut
   copy

.. raw:: html

   <hr>
   
.. toctree::
   :maxdepth: 4
      
   find
   Speech

结果:

这篇关于我可以在Sphinx目录中添加单杠吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆