无法呈现 python reST 格式文档字符串
Can't render python reST format docstring
我在研究一个python框架scrapy,我了解到它使用了如下的docstring风格
class CrawlerRunner(__builtin__.object)
| This is a convenient helper class that keeps track of, manages and runs
| crawlers inside an already setup Twisted `reactor`_.
|
| The CrawlerRunner object must be instantiated with a
| :class:`~scrapy.settings.Settings` object.
|
| __init__(self, settings=None)
|
| crawl(self, crawler_or_spidercls, *args, **kwargs)
| Run a crawler with the provided arguments.
|
| It will call the given Crawler's :meth:`~Crawler.crawl` method, while
| keeping track of it so it can be stopped later.
我想知道所有这些特殊字符的作用或含义。我遇到了 this article and kinda had vague idea of what reST format is. I wanted to know how this docstring is supposed to be rendered so tried this online renderer 但它没有正确呈现文档字符串。似乎它不支持诸如 :class: 和 :meth:
之类的东西
我的问题是
- 为什么我无法呈现文档字符串。它不是有效的 reST 格式吗?
- 难道根本不应该呈现这种风格的文档字符串吗?或者
应该以纯文本形式阅读吗?
- 如果可以,我该如何渲染?
- 是否可以在交互式 python shell 中呈现文档字符串?
Why couldn't I render the docstring. Isn't it valid reST format?
reST 有效,但它包含不属于“标准 reST”的标记,这就是 http://rst.ninjs.org/ renderer supports (it uses rst2html.py, provided by Docutils).
:class:
和 :meth:
是 Sphinx 文档生成器理解的标准 reST 的补充示例。参见 http://www.sphinx-doc.org/en/stable/markup/index.html and http://www.sphinx-doc.org/en/stable/domains.html。
下面的标记,
:class:`~scrapy.settings.Settings`
呈现为指向 scrapy.settings.Settings
class 文档的超链接。参见 https://doc.scrapy.org/en/1.3/topics/api.html#scrapy.crawler.CrawlerRunner。
Isn't this style of docstring supposed to be rendered at all? Or should it be read as plain text?
How can I render this if I can?
文档字符串应该由 Sphinx 处理。
Is it possible to have rendered docstring in interactive python shell?
我想可以实现一些让控制台输出更好的东西,但我不知道有任何工具或库可以做到这一点。
我在研究一个python框架scrapy,我了解到它使用了如下的docstring风格
class CrawlerRunner(__builtin__.object)
| This is a convenient helper class that keeps track of, manages and runs
| crawlers inside an already setup Twisted `reactor`_.
|
| The CrawlerRunner object must be instantiated with a
| :class:`~scrapy.settings.Settings` object.
|
| __init__(self, settings=None)
|
| crawl(self, crawler_or_spidercls, *args, **kwargs)
| Run a crawler with the provided arguments.
|
| It will call the given Crawler's :meth:`~Crawler.crawl` method, while
| keeping track of it so it can be stopped later.
我想知道所有这些特殊字符的作用或含义。我遇到了 this article and kinda had vague idea of what reST format is. I wanted to know how this docstring is supposed to be rendered so tried this online renderer 但它没有正确呈现文档字符串。似乎它不支持诸如 :class: 和 :meth:
之类的东西我的问题是
- 为什么我无法呈现文档字符串。它不是有效的 reST 格式吗?
- 难道根本不应该呈现这种风格的文档字符串吗?或者
应该以纯文本形式阅读吗? - 如果可以,我该如何渲染?
- 是否可以在交互式 python shell 中呈现文档字符串?
Why couldn't I render the docstring. Isn't it valid reST format?
reST 有效,但它包含不属于“标准 reST”的标记,这就是 http://rst.ninjs.org/ renderer supports (it uses rst2html.py, provided by Docutils).
:class:
和 :meth:
是 Sphinx 文档生成器理解的标准 reST 的补充示例。参见 http://www.sphinx-doc.org/en/stable/markup/index.html and http://www.sphinx-doc.org/en/stable/domains.html。
下面的标记,
:class:`~scrapy.settings.Settings`
呈现为指向 scrapy.settings.Settings
class 文档的超链接。参见 https://doc.scrapy.org/en/1.3/topics/api.html#scrapy.crawler.CrawlerRunner。
Isn't this style of docstring supposed to be rendered at all? Or should it be read as plain text?
How can I render this if I can?
文档字符串应该由 Sphinx 处理。
Is it possible to have rendered docstring in interactive python shell?
我想可以实现一些让控制台输出更好的东西,但我不知道有任何工具或库可以做到这一点。