restructuredtext

How would I cross-reference a function generated by autodoc in Sphinx?

早过忘川 提交于 2019-11-27 19:38:17
I am using the Sphinx autodoc feature to generate documentation based on the docstrings of my Python library. The syntax for cross referencing is found here A label must precede the section in order to allow that section to be referenced from other areas of the documentation. What I have is a .rst (ReStructeredText) file for one of my classes. It uses .. autoclass:: classname :members: To generate documentation for the class. My question is, how would I reference the auto-generated methods of the class from another .rst document in the documentation? If I try to place a label within the method

How to use Python to programmatically generate part of Sphinx documentation

被刻印的时光 ゝ 提交于 2019-11-27 19:05:29
I am using Sphinx to generate the documentation for a project of mine. In this project, I describe a list of available commands in a yaml file which, once loaded, results in a dictionary in the form {command-name : command-description} for example: commands = {"copy" : "Copy the highlighted text in the clipboard", "paste" : "Paste the clipboard text to cursor location", ...} What I would like to know, is if there is a method in sphinx to load the yaml file during the make html cycle, translate the python dictionary in some reStructuredText format (e.g. a definition list ) and include in my

How to add extra whitespace between section header and a paragraph

﹥>﹥吖頭↗ 提交于 2019-11-27 13:55:27
I want to have more space between the header and the paragraph and between the paragraphs. I doesn't want this to be a global setting but I want to use it where and when required. Appreciate any suggestions. You can use vertical bars at the beginning of lines to produce blank lines in the output. Like this: Heading ------- | | Paragraph with text. I just had this problem and as davidjb pointed out, using | gives you too much space on LaTeX output. This is how I solved it. Define the following: .. |vspace| raw:: latex \vspace{5mm} Then you can just use |vspace| on the places where you want the

sphinx, restructuredtext: set color for a single word

北慕城南 提交于 2019-11-27 11:17:13
问题 Is there a way to set the color of single words (or characters) in sphinx? I'm pretty sure there should be some markup tag, like HTML's font tag. 回答1: If you want to do this without being tied to html, try applying a different style than normal body text to your word. In this example adapted from the rst2pdf manual, I apply the existing rubric style which is red in the backend that I am using: Before red. .. role:: rubric I like color :rubric:`rubric`. After red. The actual look of the word

How to use color in text with ReStructured Text (rst2html.py) or how to insert HTML tags without blank lines?

馋奶兔 提交于 2019-11-27 11:10:28
问题 How can I use color with ReStructured Text? For example, **hello** translates into <strong>hello</strong> . How can I make ReStructure(rst2html.py) translate something into <font color="####">text</font> ? I thought about ..raw:: html, but it introduces blank lines. I want to insert HTML tags without blank lines. 回答1: I found this method working First, you have the role. .. role:: red An example of using :red:`interpreted text` It translates into as follows. <p>An example of using <span class

ReST strikethrough

随声附和 提交于 2019-11-27 11:06:51
Is it possible to strike text through in Restructured Text? Something that for example renders as a <strike> tag when converted to HTML, like: ReSTructuredText gozzilli I checked the docs better, as suggested by Ville Säävuori, and I decided to add the strikethrough like this: .. role:: strike :class: strike In the document, this can be applied as follows: :strike:`This text is crossed out` Then in my css file I have an entry: .strike { text-decoration: line-through; } There is at least three ways of doing it: .. role:: strike An example of :strike:`strike through text`. .. container:: strike

Adding a cross-reference to a subheading or anchor in another page

白昼怎懂夜的黑 提交于 2019-11-27 09:42:53
问题 How to insert a cross-reference in a reST/Sphinx page to either a sub-header or anchor in another page in the same documentation set? 回答1: Ignore this answer, it does not work: Better use the answer from Louis, below For anchor, you may define "short" anchor names like this: .. _ShortAnchor: Target Header goes here ======================= Some text. To refer to that header use: For more details, see ShortAnchor_. Note, that this even expands ShortAnchor to full name of the header. You may

Parsing reStructuredText into HTML

别来无恙 提交于 2019-11-27 09:28:29
问题 I'm making a framework in which I let developers describe their package using reStructuredText. I want to parse that reStructuredText into HTML so I can show it in a GUI. I'm familiar with the excellent Sphinx, but I've never otherwise parsed reStructuredText. I imagined something like a function that takes a string of reStructuredText, and possibly several additional arguments, and returns a string of HTML. So I looked into Docutils, which is responsible for parsing reStructuredText. I

How would I cross-reference a function generated by autodoc in Sphinx?

99封情书 提交于 2019-11-27 04:23:30
问题 I am using the Sphinx autodoc feature to generate documentation based on the docstrings of my Python library. The syntax for cross referencing is found here A label must precede the section in order to allow that section to be referenced from other areas of the documentation. What I have is a .rst (ReStructeredText) file for one of my classes. It uses .. autoclass:: classname :members: To generate documentation for the class. My question is, how would I reference the auto-generated methods of

How to parse restructuredtext in python?

血红的双手。 提交于 2019-11-27 03:12:00
问题 Is there any module that can parse restructuredtext into a tree model? Can docutils or sphinx do this? 回答1: Docutils does indeed contain the tools to do this. What you probably want is the parser at docutils.parsers.rst See this page for details on what is involved. There are also some examples at docutils/examples.py - particularly check out the internals() function, which is probably of interest. 回答2: I'd like to extend upon the answer from Gareth Latty. "What you probably want is the