Sphinx extension and utility to add a versions menu to Doctr-deployed documentation.
Doctr is a tool that deploys Sphinx documentation to Github Pages. It is an alternative to the popular Read the Docs (RTD). Compared to RTD, Doctr gives full control over the documentation build process. However, Doctr out of the box does not support documentation for multiple versions of a package at the same time (unlike RTD).
The doctr-versions-menu
package aims to remedy this. It provides a Sphinx
extension and a command line tool that work together to generate a dynamic
versions menu similar to that on RTD pages:
It also injects warnings for outdated or unreleased versions.
See the doctr-versions-menu
documentation itself for a live example.
Development of Doctr Versions Menu happens on Github. You can read the full documentation online.
master
)
be considered functional.
To install the latest released version of doctr-versions-menu, run this command in your terminal:
$ pip install doctr-versions-menu
This is the preferred method to install Doctr Versions Menu, as it will always install the most recent stable release.
If you don't have pip installed, the Python installation guide, respectively the Python Packaging User Guide can guide you through the process.
To install the latest development version of doctr-versions-menu
from Github.
$ pip install git+https://github.com/goerz/doctr_versions_menu.git@master#egg=doctr_versions_menu
Showing a versions menu in your documentation requires two steps:
Add
'doctr_versions_menu'
to the list of extensions in your Sphinxconf.py
.This adds javascript to your rendered documentation that displays a dynamic versions menu based on information in a
versions.json
file it expects to find in the root for yourgh-pages
branch.Call the
doctr-versions-menu
command as part ofdoctr deploy
.For example,
python -m doctr deploy --command="doctr-versions-menu" --no-require-master --build-tags "$DEPLOY_DIR"
This causes
doctr-versions-menu
to be executed in the root of thegh-pages
branch. The script examines the folders that exist there, and generates theversions.json
file that step 1 relies on.
See the full documentation for Step 1 and Step 2 for details.