问题
In my custom.css file I have,
.bold {
font-weight: bold;
}
.red {
color:red;
}
And in my _.rst file,
.. role:: bold
.. role:: red
But if I try to nest/compound them, only the outermost role takes effect, e.g.
:bold:`:red:`This is only bold``
This is only bold
Is there a way to combine these effects without defining a new (combined) role?
回答1:
you can use a custom css class directive:
.. cssclass:: boldred
bold red text
and update the css to format the boldred class
回答2:
Roles are defined that the can not be nested.
Neither HTML nor LaTeX, as backends, support overlapping of styles.
来源:https://stackoverflow.com/questions/43162240/nested-compounded-roles-apply-multiple-roles-to-overlapping-text