Add a class to a table in Sphinx?

馋奶兔 提交于 2019-11-28 12:16:53

The Sphinx default domain is Python and it contains a class directive which shadows the original Docutils directive with the same name.

To make it work, use rst-class instead:

.. rst-class:: special

== == ==
a  b  c
1  2  3
== == ==

See http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#id2.

Alternatively you could instead wrap your table with a .. table:: directive and use its :class: option:

.. table::
   :class: special

   == == ==
   a  b  c
   1  2  3
   == == ==

See the corresponding docutils docs here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!