a blog by Marius Gedminas

Posts tagged Github

Adding "Edit on GitHub" links to Sphinx pages

Documentation pages on ReadTheDocs have a nice sidebar with extra "Show on GitHub" and "Edit on GitHub" links. Here's how you can have those for your own Sphinx documentation: Create _ext and _templates subdirectories. Create a file _ext/edit_on_github.py that hooks into html-page-context to add a couple of template variables. Create a file _templates/sourcelink.html that uses those two variables to insert "Show on GitHub" and "Edit on GitHub" links in the sidebar.