我该如何在Sphinx/RestructuredText中上标®符号?
这种写法是不正确的,你会得到一个带有上标的|reg|。
这种写法是不正确的,你会得到一个带有上标的|reg|。
bigNameBrand\ :sup:`|reg|`
bigNameBrand\ :sup:`|reg|`
通过创建自定义角色找到了一种解决方法。唉,我不应该这样做。
在conf.py中:
def supsub_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
node = docutils.nodes.superscript()
node2 = docutils.nodes.substitution_reference(refname=text)
node += [node2]
return [node],[]
def setup(app):
app.add_role('supsub', supsub_role)
然后:
.. |regsup| replace:: :supsub:`reg`
|regsup|
来获取上标注册商标。
®
”不是您的选择吗? - Timotheus.Kampik