restructuredtext

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

How would I cross-reference a function generated by autodoc in Sphinx? Question: 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 …

Total answers: 2

How to document a module constant in Python?

How to document a module constant in Python? Question: I have a module, errors.py in which several global constants are defined (note: I understand that Python doesn’t have constants, but I’ve defined them by convention using UPPERCASE). “””Indicates some unknown error.””” API_ERROR = 1 “””Indicates that the request was bad in some way.””” BAD_REQUEST = …

Total answers: 8

How to insert blank line using reStructuredText / Sphinx

How to insert blank line using reStructuredText / Sphinx Question: I want to add a blankline (or add more whitespace) between heading and the image using ReStructuredText: ==== John ==== .. image:: _static/john.JPG :alt: John :height: 300px :width: 400px But I don’t know how to do it? Asked By: xxks-kkk || Source Answers: Use the …

Total answers: 1

How to parse restructuredtext in python?

How to parse restructuredtext in python? Question: Is there any module that can parse restructuredtext into a tree model? Can docutils or sphinx do this? Asked By: zhangailin || Source Answers: 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 …

Total answers: 2

Are there any real alternatives to reStructuredText for Python documentation?

Are there any real alternatives to reStructuredText for Python documentation? Question: I’m starting an open source Python project shortly and I’m trying to decide in advance how to write my docstrings. The obvious answer would be using reStructuredText and Sphinx with autodoc, because I really like the idea of simply properly documenting my code in …

Total answers: 7

Have the same README both in Markdown and reStructuredText

Have the same README both in Markdown and reStructuredText Question: I have a project hosted on GitHub. For this I have written my README using the Markdown syntax in order to have it nicely formatted on GitHub. As my project is in Python I also plan to upload it to PyPi. The syntax used for …

Total answers: 8

Substitutions inside Sphinx code blocks aren't replaced

Substitutions inside Sphinx code blocks aren't replaced Question: In this reST example meant to be rendered by Sphinx, |yaco_url| doesn’t get replaced because it’s in a code-block: .. |yaco_url| replace:: http://yaco.es/ You can use wget to download it: .. code-block:: console $ wget |yaco_url|package.tar.gz I wonder if there is some way to force the replacement …

Total answers: 2

How to add extra whitespace between section header and a paragraph

How to add extra whitespace between section header and a paragraph Question: 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. Asked By: Aravind Yarram || …

Total answers: 2

How to right-align columns content in reStructuredText simple tables?

How to right-align columns content in reStructuredText simple tables? Question: I’m editing the documentation for a project of mine using Sphinx, which in turn uses reStructuredText as markup language. I have a simple table (as opposed to grid table) in which the rightmost column reports contains numbers that I would like to right-align, but I …

Total answers: 5