Skip to main content
 首页 » 编程设计

python之转义空格时在内联标记内进行替换

2024年10月24日9soundcode

给定以下 reST 文档

.. |bar| replace:: baz 
 
bolded? :strong:`\ |bar|\ ` 
 
bolded? **\ |bar|** 
 
.. This one errors out 
.. bolded? **\ |bar|\ ** 

如何创建加粗的替代值?我要

bolded? baz

这里有一个在线编辑器的链接来测试它:http://rst.ninjs.org/?n=f57ac95e1fe1643572b45d7ae8f8950c&theme=basic

请您参考如下方法:

由于 reStructuredText 不支持嵌套内联标记,因此使用样式文本创建引用的唯一方法是使用“替换”指令进行替换

http://docutils.sourceforge.net/docs/ref/rst/directives.html#replacement-text