相关疑难解决方法(0)

在reStructuredText中的链接中设置文本格式

如何在reStructuredText中的表示链接中格式化文本?

具体来说,我希望从我的第一个生成以下HTML:

<a href="http://docs.python.org/library/optparse.html"><tt>optparse.OptionParser</tt> documentation documentation</a>
Run Code Online (Sandbox Code Playgroud)

结果应如下所示:

optparse.OptionParser 文件

其中"optparse.OptionParser"部分是固定宽度字体.

我试过了

```optparse.OptionParser`` <http://docs.python.org/library/optparse.html>`_
Run Code Online (Sandbox Code Playgroud)

然而,这给了

<tt class="docutils literal">`optparse.OptionParser</tt> documentation &lt;<a class="reference external" href="http://docs.python.org/library/optparse.html">http://docs.python.org/library/optparse.html</a>&gt;`_
Run Code Online (Sandbox Code Playgroud)

看起来像这样

``optparse.OptionParser documentation <http://docs.python.org/library/optparse.html>\_

restructuredtext python-sphinx

68
推荐指数
3
解决办法
6550
查看次数

Sphinx代码块中的替换

在这个reST示例意味着由Sphinx呈现,| yaco_url | 不会被替换,因为它在代码块中:

.. |yaco_url| replace:: http://yaco.es/

You can use wget to download it:

.. code-block:: console

    $ wget |yaco_url|package.tar.gz
Run Code Online (Sandbox Code Playgroud)

我想知道是否有某种方法可以强制更换| yaco_url | 在渲染代码块之前.

python restructuredtext python-sphinx

30
推荐指数
2
解决办法
3732
查看次数

如何在Sphinx .rst文件中输出配置值?

我有以下内容conf.py:

def setup(app):
    app.add_config_value('base_url','http://localhost:2000', True)
Run Code Online (Sandbox Code Playgroud)

如何将其插入我的.rst文件?我写了这个:

:base_url:/my_app/api/application/
Run Code Online (Sandbox Code Playgroud)

但它只打印:base_url:而不是实际的URL.

如何获取要发出的实际配置值?

python python-sphinx

18
推荐指数
1
解决办法
4133
查看次数

标签 统计

python-sphinx ×3

python ×2

restructuredtext ×2