内联索引关键字突出显示

时间:2017-09-30 17:45:14

标签: python-sphinx restructuredtext

我正在尝试编写restructuredText标记,同时在索引中创建一个条目并突出显示文本中的提及。我试过了

In this chapter, we introduce :index:`*Foo* <Foo>`, a
crucial concept in this example

可以创建索引条目,但文本将是

  

在本章中,我们将介绍* Foo *,这个例子中的一个关键概念

而不是

  

在本章中,我们将介绍 Foo ,这个例子中的一个关键概念

我能以某种方式做到这一点吗?

3 个答案:

答案 0 :(得分:0)

您可以将样式添加到span.xref.std.std-term吗?例如,在source/_static/custom.css放置:

@import url("default.css");

span.xref.std.std-term {
  font-style: italic;
}

所有索引引用都是 italic ...

答案 1 :(得分:0)

到目前为止我找到的最好的解决方法是

In this chapter, we introduce :index:`\ <Foo>`\ *Foo*, a
crucial concept in this example

答案 2 :(得分:0)

我只是想添加评论,但没有足够的声誉。

我遇到了同样的问题,我想知道:可以定义一个新角色来替换:index:并正确处理这个问题吗?如果这不是一件大事,我愿意学习如何为此扩展Sphinx。

相关问题