嵌套/复合角色:将多个角色应用于重叠文本

时间:2017-04-01 21:32:25

标签: python-sphinx restructuredtext

在我的custom.css文件中,

.bold {
    font-weight: bold;
}

.red {
    color:red;
}

在我的_.rst文件中,

.. role:: bold

.. role:: red

但是如果我试图嵌套/复合它们,只有最外面的角色生效,例如

:bold:`:red:`This is only bold``

这只是粗体

有没有办法在不定义新的(组合)角色的情况下组合这些效果?

2 个答案:

答案 0 :(得分:1)

you can use a custom css class directive:

.. cssclass:: boldred

  bold red text

and update the css to format the boldred class

答案 1 :(得分:-2)

定义了无法嵌套的角色。

作为后端的HTML和LaTeX都不支持样式重叠。