How to host a privately owned documentation with ReadTheDocs or Sphinx

The only thing you need to host sphinx documentation is a static file server (the search works without a back end, see my answer here. That said, using a private readthedocs server is probably over-engineering. Just deploy the files to a static file server and point the base URL (e.g. docs.myapp.com) to the index.html file. … Read more

Disabling individual Sphinx warning messages

Are there .rst files in your Sphinx project whose content you don’t want in the output? Use the exclude_patterns configuration variable. No output (and no warning messages) will be generated for files matching the specified patterns. See http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-exclude_patterns. Are there .rst files in your Sphinx project that are not part of any toctree but whose … Read more

Sphinx: how to exclude imports in automodule?

There is no way to tell Sphinx to exclude some imports. When using autodoc, all documented modules must be cleanly importable. You might be able to work around the problem by doing some mocking. Here is an article describing the solution to a problem that seems quite similar to yours: http://blog.rtwilson.com/how-to-make-your-sphinx-documentation-compile-with-readthedocs-when-youre-using-numpy-and-scipy/. Here is a small … Read more

How do I have multiple versions of my doc with sphinx?

You could just use Read The Docs to host your documentation for you. They automatically handle multiple versions with a dropdown: https://docs.readthedocs.io/en/latest/index.html If you’d like to host your own documentation on GitHub Pages or some other web server, I made a Sphinx extension that does what you’re looking for: https://github.com/sphinx-contrib/sphinxcontrib-versioning

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

Retaining inline code inside references in Sphinx

If you have a look at :ref: documentation in its official web site about inline markups: :ref: To support cross-referencing to arbitrary locations in any document, the standard reST labels are used. For this to work label names must be unique throughout the entire documentation … I think (as @Kevin Horn) it’s no possible right … Read more

tech