4

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>标签中?

4

2 回答 2

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>标签,但应该可以正确设置文档样式。

于 2014-01-18T00:55:20.353 回答
1

您可以编写自己的主题模板来执行此操作。

于 2013-12-14T10:28:42.007 回答