如何格式化 reStructuredText 中指定链接内的文本?
具体来说,我希望从我的第一个代码生成以下 HTML:
<a href="http://docs.python.org/library/optparse.html"><tt>optparse.OptionParser</tt> documentation documentation</a>
结果应该是这样的:
optparse.OptionParser文档
其中“optparse.OptionParser”部分采用固定宽度字体。
I tried
```optparse.OptionParser`` <http://docs.python.org/library/optparse.html>`_
然而,这给了
<tt class="docutils literal">`optparse.OptionParser</tt> documentation <<a class="reference external" href="http://docs.python.org/library/optparse.html">http://docs.python.org/library/optparse.html</a>>`_
看起来像这样
``optparse.OptionParser
documentation
<http://docs.python.org/library/optparse.html>\
_
这个构造:
Here you have |optparse.OptionParser|_.
.. |optparse.OptionParser| replace:: ``optparse.OptionParser`` documentation
.. _optparse.OptionParser: http://docs.python.org/library/optparse.html
生成此 HTML(添加了一些换行符):
<p>Here you have
<a class="reference external" href="http://docs.python.org/library/optparse.html">
<tt class="docutils literal"><span class="pre">optparse.OptionParser</span></tt> documentation</a>.
</p>
我意识到这不是exactly你所要求的,但也许已经足够接近了。也可以看看http://docutils.sourceforge.net/FAQ.html#is-nested-inline-markup-possible.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)