相关疑难解决方法(0)

Sphinx,reStructuredText显示/隐藏代码片段

我一直在使用SphinxreStructuredText记录软件包.

在我的文档中,有一些很长的代码片段.我希望能够将它们隐藏为默认值,并使用一个"显示/隐藏"按钮来扩展它们(示例).

有没有一种标准的方法可以做到这一点?

restructuredtext show-hide code-snippets python-sphinx

18
推荐指数
5
解决办法
7709
查看次数

如何为reStructuredText,Sphinx,ReadTheDocs等设置自定义样式?

我想用我自己的自定义样式扩展SphinxReadTheDocs使用的主题.

我能做到这一点的最佳方式是什么,以便我的改变能够坚持下去?

css restructuredtext python-sphinx read-the-docs

13
推荐指数
1
解决办法
3572
查看次数

让sphinx的autodoc在参数说明中显示默认值

我有以下docstring:

def progress_bar(progress, length=20):
    '''
    Returns a textual progress bar.

    >>> progress_bar(0.6)
    '[##########--------]'

    :param progress: Number between 0 and 1 describes the progress.
    :type progress: float
    :param length: The length of the progress bar in chars. Default is 20.
    :type length: int
    :rtype: string
    '''
Run Code Online (Sandbox Code Playgroud)

有没有办法告诉sphinx如果可用,将"Default is X"部分添加到参数的描述中?

python python-sphinx autodoc

9
推荐指数
2
解决办法
1434
查看次数

自定义sphinxdoc主题

有一种简单的方法来定制现有sphinxdoc主题吗?对于默认主题,有许多主题属性,但在sphinxdoc中,我甚至无法设置徽标或更改某些颜色?

或者你能推荐一个我可以学习如何修改主题的网站吗?

python themes python-sphinx

7
推荐指数
2
解决办法
1万
查看次数

如何在 Sphinx autodoc 中的函数签名之间创建水平线和空白

我已经为我想做的大部分事情找到了 sphinx 选项,但是在使用 autodoc 时,我看不到如何在函数签名之间注入空格和水平线。

以下是 autodoc 生成的内容:

get_all_edges(network=None, base_url='http://localhost:1234/v1')
   docstring for get_all_edges

get_all_nodes(network=None, base_url='http://localhost:1234/v1')
   docstring for get_all_nodes

get_edge_count(network=None, base_url='http://localhost:1234/v1')
   docstring for get_edge_count
Run Code Online (Sandbox Code Playgroud)

这是我想要得到的:

get_all_edges(network=None, base_url='http://localhost:1234/v1')
   docstring for get_all_edges

   ------------------------------------------------------------

get_all_nodes(network=None, base_url='http://localhost:1234/v1')
   docstring for get_all_nodes

   ------------------------------------------------------------

get_edge_count(network=None, base_url='http://localhost:1234/v1')
   docstring for get_edge_count
Run Code Online (Sandbox Code Playgroud)

......或接近于此的东西。我对最后一个函数签名是否有尾随分隔符不感兴趣。也许这很简单,但我没有看到。谢谢!

仅供参考,这里是生成我的函数签名的 autodoc 指令:

PyCy3.networks module
---------------------

.. automodule:: PyCy3.networks
    :members:
    :undoc-members:
    :show-inheritance:
Run Code Online (Sandbox Code Playgroud)

python formatting python-sphinx autodoc read-the-docs

4
推荐指数
1
解决办法
1280
查看次数