Questions tagged [python-sphinx]

Sphinx is a tool that makes it easy to create intelligent and beautiful documentation. Sphinx is especially suitable for Python documentation, but it is a general-purpose tool that can be used to document anything.

Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license.

It was originally created for the new Python documentation, and it has excellent facilities for the documentation of Python projects, but C/C++ is already supported as well, and it is planned to add special support for other languages as well.

Sphinx is under constant development. The following features are present, work fine and can be seen “in action” in the Python documentation:

  • Output formats: HTML (including Windows HTML Help), LaTeX (for printable PDF versions), ePub, Texinfo, manual pages, plain text.

  • Extensive cross-references: semantic markup and automatic links for functions, classes, citations, glossary terms and similar pieces of information.

  • Hierarchical structure: easy definition of a document tree, with automatic links to siblings, parents and children.

  • Automatic indices: general index as well as a module index.

  • Code handling: automatic highlighting using the Pygments highlighter.

  • Extensions: automatic testing of code snippets, inclusion of docstrings from Python modules (API docs), and more.

Sphinx uses reStructuredText as its markup language, and many of its strengths come from the power and straightforwardness of reStructuredText and its parsing and translating suite, the Docutils.

See also:

3663 questions
2
votes
0 answers

How to use a Jinja variable inside of sphinx ref directive or head tag?

I'm using sphinx and auto-summary to create my documentation. However, for each module a I want to generate customized list of references. However, to do that, I need to pass the objname to ref directive. How can I achieve that? {{ fullname |…
daemon
  • 21
  • 1
  • 3
2
votes
1 answer

html file created by sphinx does not have any documentation

I've seen this question asked here before, for example, here, or here, or the most useful here. But I believe my problem is different than theirs, or I am doing something incorrectly. My python file hello_world is: import numpy as np """ This is…
Schach21
  • 412
  • 4
  • 21
2
votes
1 answer

How do you define your own latex preamble for sphinx autodoc?

I'd like to use the latex algpseudocode package to add algorithms to my docstrings. I'd also like to be able to define user macros to speed up my maths equation typing in the docstrings. I'm using napoleon autodoc style with sphinx to generate…
dan_sk8r
  • 41
  • 2
2
votes
1 answer

Stop Sphinx from Executing a cached classmethod property

I am writing a package for interacting with dataset and have code that looks something like from abc import ABC, ABCMeta, abstractmethod from functools import cache from pathlib import Path from warnings import warn class…
Hyperplane
  • 1,422
  • 1
  • 14
  • 28
2
votes
0 answers

Document a function on two pages in Sphinx?

I have a C API that I'm documenting using Sphinx. I'd like to have an "API Essentials" page with all the stuff most users will need, and a "Full API" page that documents absolutely everything. The trouble is, I can't find a good way to document the…
Dominick Pastore
  • 4,177
  • 2
  • 17
  • 29
2
votes
1 answer

How can I change font using ReStructured Text with .. raw:: html?

I'm working on a project using Sphinx for the first time and wanted to create a method (I'm not sure if that is what it's called, but similar to programming methods just a body of text to do a specific task) to change the font in my Sphinx project.…
2
votes
1 answer

Embedding a html document inside of RST

I have a Sphinx-based website and have specific pages on which I would like to display predefined html files that are stored in a specified directory like _static. In Django, it's possible to simply reference the file from the template using an…
Yes
  • 339
  • 3
  • 19
2
votes
2 answers

Sphinx - How to maintain side bar content between pages?

I have this source directory structure: . ├── conf.py ├── devel │   └── python │   ├── Controles de flujo, condicionales y bucles.md │   ├── Encapsulamiento.md | ├── (...) ├── index.rst ├── _static ├── _templates └── webdevel This is…
2
votes
1 answer

In Sphinx, how to create a reference to a table specific row?

I thought to cross reference I have to enter the starting format as :ref:`Link Text ` Then use it later on by writing .. _CrossReferenceLabel: Like the following. +-----------+-----------------------------------+-------+ …
Iancovici
  • 5,574
  • 7
  • 39
  • 57
2
votes
1 answer

Sphinx cross-reference in LaTeX

I have the following reference identified in file A: .. _my-label: and I reference it in file B : this is a reference to file A :ref:`my-label` This generates a cross-reference as expected when outputting HTML. However, when outputting LaTeX, it…
FenryrMKIII
  • 1,068
  • 1
  • 13
  • 30
2
votes
2 answers

Docstrings are not included in Read the Docs Sphinx build

I built a Sphinx documentation and the build works well locally. My docstrings appear as shown below. When moving to readthedoc.io, I added a specific requirement file under docs/requirement.txt which…
clematologie
  • 177
  • 1
  • 9
2
votes
0 answers

Docs generated by sphinx: make a search in source code as well

When I search for certain keywords on sphinx generated documentation from a python package (generated with a conf.py and the sphinx-apidoc), this search yields results of the documentation produced based on the docstrings only. However, my…
deponovo
  • 1,114
  • 7
  • 23
2
votes
0 answers

how to use vscode restructuredtext extension ( lextudio.restructuredtext) with myst-parser on markdown file?

I have a project configured to use Sphinx and the Myst-parser to build my documentation. The build is fine and everything works (my conf.py in sphinx is OK). Now, I use VSCode as an editor and I would like to have a "live preview" in vscode for my…
Mathias Rime
  • 21
  • 1
  • 2
2
votes
1 answer

How do I get Sphinx to markup C calls in text the way the standard Python docs do?

In the standard Python documentation, system calls appear as bold, fixed-width font. You can see this in the asyncore section, when it mentions select() or poll() for example: http://docs.python.org/py3k/library/asyncore.html I checked the source…
shane
  • 68
  • 6
2
votes
1 answer

VSCode extension to auto generate C docstring?

I'm starting to get into more advanced codding practices and came across the need to create full documentations for my libraries which I write in C in the VSCode IDE and in an effort to try and same time I'm looking for a way to auto generate C…
MikeLemo
  • 521
  • 1
  • 5
  • 11