重构文本中的符号
我想在restructedText中使用一些符号;我该怎么做? (例如,Markdown 中的 →
会生成 中定义的“→”符号标准 HTML 字符实体列表 - 另请参阅w3c 参考< /a>)
注意:我不想要求数学公式支持作为依赖项。
I want to use some symbols in restructuredText; how can I do this? (e.g. →
in Markdown yields the "→" symbol as defined in the list of standard HTML character entities -- see also w3c reference)
Note: I don't want to require math formula support as a dependency.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
通过“替换”运算符您可以定义大量符号。
您必须通过
.. include::
或类似的方式包含定义。其中大多数的形式为
|larr|
或|rarr|
。它们在
docutils.parsers.rst.include
安装目录中定义。有数十个文件定义了大量的 Unicode 字符。You have a large number of defined symbols via the "substitution" operator.
You have to include the definitions via
.. include:: <isonum.txt>
or something similar.Most of them have the form
|larr|
or|rarr|
.They are defined in the
docutils.parsers.rst.include
installation directory. There are dozens of files which define numerous Unicode characters.我的印象是首先支持 Unicode,然后再支持。您可以只输入原始字符并让
docutils
处理 HTML 编码吗?It was my impression that rst supported Unicode; can you just type in the raw character and let
docutils
handle encoding for HTML?我想你正在寻找这个:http://docutils.sourceforge。 net/docs/ref/rst/roles.html#raw
您可以定义以下角色:
然后您可以编写:
呈现如下:
这样 →
I think you were looking for this: http://docutils.sourceforge.net/docs/ref/rst/roles.html#raw
You can define the following role:
And then you can write:
Which renders like this:
This way →
在使用 Sphinx 从 Windows 中包含 ± 字符的 .rst 文件制作 html 时,我遇到了类似的问题。将文件编码从 windows-1252 更改为 UTF-8 为我解决了这个问题。
只需用记事本打开,另存为...,然后将编码:更改为 UTF-8
I had a similar problem when making html from .rst files containing the ± character in Windows using Sphinx. Changing the file encoding from windows-1252 to UTF-8 fixed it for me.
Simply open with notepad, Save As..., and change Encoding: to UTF-8