Sphinx:在角色中使用占位符

Sphinx: Use placeholders in roles

我正在编写 sphinx 文档,目前面临以下问题:

我正在为不同的显示选项使用角色。现在我想在角色中的某个文本中添加字体超棒的徽标,但我使用的占位符在角色定义中不起作用。举个例子:

:ver:`|Cubes| random text`

ver 是我的 class,|Cubes| 是超赞字体徽标的占位符。 问题是,占位符在 | 之前和之后需要一个 white-space但是对于角色定义,在`.

之后或之前不能有白色-space

有没有办法在不为我在文档中使用的每个徽标创建不同角色的情况下解决这个问题?

感谢您的每一个回答:)

没有。来自 Interpreted Text:

Interpreted text is text that is meant to be related, indexed, linked, summarized, or otherwise processed, but the text itself is typically left alone.

详情见Inline markup recognition rules

顺便说一句,你所说的 "placeholders" 是 reST 术语中的替换。