嵌套/复合角色:将多个角色应用于重叠文本 [英] Nested / Compounded roles: apply multiple roles to overlapping text

查看:30
本文介绍了嵌套/复合角色:将多个角色应用于重叠文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 custom.css 文件中,

.bold {
    font-weight: bold;
}

.red {
    color:red;
}

在我的 _.rst 文件中,

.. role:: bold

.. role:: red

但是如果我尝试嵌套/复合它们,则只有最外层的角色才会生效,例如

But if I try to nest/compound them, only the outermost role takes effect, e.g.

:bold:`:red:`这只是粗体``

这只是粗体

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

Is there a way to combine these effects without defining a new (combined) role?

推荐答案

您可以使用自定义 css 类指令:

you can use a custom css class directive:

.. cssclass:: boldred

  bold red text

并更新 css 以格式化粗体类

and update the css to format the boldred class

这篇关于嵌套/复合角色:将多个角色应用于重叠文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆