如何删除sphinx文档中内部超链接的重点

时间:2013-12-14 00:08:55

标签: python-sphinx restructuredtext

sphinx中的交叉引用是使用ref完成的,如:

.. _my-reference-label:

Section to cross-reference
--------------------------

This is the text of the section.

It refers to the section itself, see :ref:`my-reference-label`.

当编译为HTML时,上面会在“see”之后引入一个超链接,但也会将其嵌入<em>标记中,使内部引用看起来与外部超链接不同。

有没有办法指示sphinx不要强调内部引用,也就是说,不要将它们嵌入<em>标记中?

2 个答案:

答案 0 :(得分:2)

您可以在CSS文件中添加一行:

a.internal {font-style: normal}

为了让Sphinx使用自定义CSS文件,您需要修改conf.py

html_style = 'my_style.css'

然后将文件放在_static目录中,或者使用html_static_path声明的目录。

然后my_style.css可能如下:

@import url("default.css");  /* This should be the file used by your theme */

/* Internal links */
a.internal {font-style: normal}

这不会消除周围的<em>标记,但应该可以正确设置文档的样式。

答案 1 :(得分:1)

您可以编写自己的themetemplate来执行此操作。

相关问题