在reStructuredText中,:code:`Observation`将创建一个内联代码块,该代码块在文档中显示为Observation。在我的例子中,它引用了我的Observation类。在生成的文档中,我希望能够做一些事情,比如使用所有格形式(Observation)并引用多个对象(Observation)。然而,后者会导致警告/错误。
sphinx.errors.SphinxWarning: Inline interpreted text or phrase reference start-string without end-string.
值得注意的是,在其他情况下,我在内联代
我正在使用Sphinx来记录python项目,并尝试创建一个可重用的提示,以便在多个位置使用。
通常,我将在python文件中使用以下语法:
"""
.. tip::
I want this tip to be used in several locations. Why?
- Save time
- Work less
"""
现在,不管我把它放在文件的开头,还是在类定义下,还是在函数定义下,这都是可行的。
我找到了 for :ref:,它建议使用标签:
.. _my_reusable_tip:
这是"ReST删除线“的后续,但在Sphinx而不是ReST上下文中。我的问题是,在sphinx中是否有一个中心位置来放置“角色”指令,或者这个指令是否真的必须在sphinx文档中的每个rst文件中重复。
更详细地说:
使用role指令很容易为内联文本定义自定义CSS样式(请参阅ReST删除线作为示例):
.. role:: custom
:class: custom
This is an :custom:`inline text`.
转换为html呈现的
.. This is an <span class="custom">inline text&
我用狮身人面像做文件。当我使用“”时,我从index.rst文件中得到以下警告。
如何删除这些警告?此外,由于这些警告,内容表没有在汇合中工作,但是文档正在代码中创建。
任何建议/帮助都是非常值得赞赏的。
[4px@learning-2 docs]$ make confluence
Running Sphinx v4.2.0
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [confluence]: targets for 0 so
我的文档中有两个重复的键-> .. command:: targetName在两个单独的页面上。我需要知道如何使用以下语法链接到这两个单独的目标:
Page-1 Click this -> :command:`targetName` # this will always open the first targetName declared in the doc
目标:
Page-1 Click this -> :command:`targetName <page-1.html#targetName>` # not working :/
Page-2 Click
我有一些reStructuredText文档。我想在在线帮助中使用它的片段。似乎有一种方法是通过引用“剪掉”标记。
.. _my_boring_section:
Introductory prose
------------------
blah blah blah
.. _my_interesting_section:
About this dialog
-----------------
talk about stuff which is relevant in contextual help
如何使用python/docutils/sphinx提取_my_interesting
我正在使用sphinx来记录一个C++项目,其中有不同的页面来记录一个类。在这些方法中,我使用了:noindex:作为类方法,因为否则它们会扰乱整个项目索引页面。
.. cpp:function:: void foo(int a)
:noindex:
然而,这也造成了一个不同之处,那就是我不能创建本地的页面链接.在医生体内寻找另一种方法:
The first argument is the same as that to :cpp:func:`foo`.
如果没有:noindex:在foo()上,这个链接就能工作。有了它,就不会产生错误,并且会有一个链接,但是它是死/无用的/无处可去。
我正在写我的项目使用sphinx的文档,我想把模块的链接放在侧栏。我可以把链接放在首页,但不能放在侧栏上。
index.rst的代码
.. DashBoard documentation master file, created by
sphinx-quickstart on Tue Dec 12 12:09:02 2017.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to DashBoard
如何在使用sphinx-build生成的html中显示警告框
Warning
Do not use the directives sectnum, header and footer.
我想把上面的信息展示如下:
(很抱歉,所以不允许我在这里的文章中嵌入图像)
请忽略文本格式,我的主要目标是显示带有一些文本的框,以引起用户的注意。
根据狮身人面像的,可以利用狮身人面像的autodoc扩展自动生成文档。我们既可以用Sphinx格式编写docstring,也可以编写Google或Numpy (后面两个带有napoleon扩展)。
是否可以用reStructuredText格式编写文档字符串?
例如:
"""[Summary]
Extended description of function.
:param int arg1: Description of arg1.
:param str arg2: Description of arg2.
:raise: ValueError if arg1 i
我的python项目中有以下docString: def challenge():
"""Route for POST a challenge.
For call this route, we need to pass a serialNumber on body form.
If this serialNumber is in the database and corresponds to a tablet we call methods for create challenge
:returns: An HTTP respons
我想知道如何在使用Sphinx生成汽车文档时有一个新的行。我没有使用默认的Sphinx文档字符串格式reStructuredText,但我使用的是Numpydoc格式。我试过使用'\n‘,但它会换行,我只需要换一行。这是一个Python模块的例子...
""" This is the first sentences
| this is the second sentence at line 2 ... note that vertical bar
| this is the second sentence at line 3 ... note that ve
我有一个类方法,它的参数以下划线from_结尾,并且我正在使用autoclass为该类生成文档。我希望参数from_在我的Sphinx文档中显示为普通文本,但目前它显示为超链接。 下面是带有docstring的类方法的简化版本: class Twilio:
def get_messages(to=None, from_=None):
"""
Get messages.
`Args:`
to: str
Receiver.
from_