Create _ext/
and _templates/
subdirectories.
Move edit_on_github.py
into the _ext/
subdirectory.
Move sourcelink.html
into the _templates/
subdirectory.
Add the following after the import sys, os
line :
sys.path.insert(0, os.path.abspath('_ext'))
Add edit_on_github
to the list of extensions :
extensions = ['edit_on_github']
Configure the extension :
edit_on_github_project = 'username/reponame'
edit_on_github_branch = 'master'
Make sure the template path is specified correctly :
templates_path = ['_templates']
It seems this extension has conflicted with sphinx.ext.viewcode.
_module/index.html is generated as a index of modules if you use sphinx.ext.viewcode. But it causes the error in edit_on_github because the page does not have doctree.
ref: sphinx-doc/sphinx#2506