How to make an internal link to a heading in sphinx restructuredtext without creating arbitrary labels?

reStructuredText supports implicit hyperlink targets. From the reStructuredText quick reference: Section titles, footnotes, and citations automatically generate hyperlink targets (the title text or footnote/citation label is used as the hyperlink name). So the following text (lifted from the reStructuredText quick reference, spelling mistakes and all): Titles are targets, too ======================= Implict references, like `Titles are … Read more

No generation of the module index “modindex” when using Sphinx

Short version run sphinx-apidoc -o . mymodule uncomment and modify conf.py. For this example, sys.path.insert(0, os.path.abspath(‘mymodule’)) re-run make html Long answer I can reproduce the issue with this sample module: $cat mymodule/mymodule.py def fn1(): ”’First function”’ pass def fn2(): ”’Second function”’ pass Running sphinx-quickstart produces the following tree: $tree . ├── Makefile ├── _build ├── … Read more

How to include the toctree in the sidebar of each page

You can customize your html sidebar in conf.py. The default html sidebar consists of 4 templates: [‘localtoc.html’, ‘relations.html’, ‘sourcelink.html’, ‘searchbox.html’] In conf.py you could change localtoc.html to globaltoc.html like this: html_sidebars = { ‘**’: [‘globaltoc.html’, ‘relations.html’, ‘sourcelink.html’, ‘searchbox.html’] } Since this in the end this will be used in HTML files, this should work on … Read more

How do we embed images in sphinx docs?

From the documenation: There are two image directives: image and figure. An image is a simple picture. A figure consists of image data (including image options), an optional caption (a single paragraph), and an optional legend (arbitrary body elements). For page-based output media, figures might float to a different position if this helps the page … Read more

How can I link/reference another reST file in the documentation?

To create links between different reStructuredText (.rst) files you can use the inline markup provided by sphinx. See the documentation under the heading Cross-referencing documents on top of the file you define its label .. _my-reference-label: then you can link to it from other documents using :ref:`my-reference-label`. I do not believe you need to use … Read more