Add source, edit, history, annotate links to GitHub or BitBucket
Project description
sphinxcontrib-srclinks
A sphinx extension to add links to various views of the documentation page source in the sphinx jinja2 template sidebar.
Contents
Features
Specify srclink_project once in sphinx conf.py
Adds links to {Source, Edit, History, Annotate} with {GitHub, BitBucket,} URLs to the sidebar.
Adds links to e.g. https://github.com/user/repo/ and https://github.com/user/repo/tree/[srclink_branchname]
Adds a <code> git clone schema://git@github.com/repo </code> block for each https, native git/hg, and ssh URL
(Sphinx HTML Documentation Sidebar)
This Page
Source RST
Source
Edit
History
Annotate
Usage
Clone the sphinxcontrib-srclinks repo:
git clone https://github.com/westurner/sphinxcontrib-srclinks
Copy srclinks.html to the _templates/srclinks.html folder:
DOCS="./docs/"
mkdir -p "$DOCS/_templates"
cp sphinxcontrib-srclinks/sphinxcontrib/srclinks/_templates/srclinks.html \
"$DOCS/_templates/srclinks.html"
BLD: conf.py: Configure the srclink_ settings in conf.py (test_html_page_context()):
# conf.py
# srclink settings
srclink_project = 'https://github.com/westurner/sphinxcontrib-srclinks'
#srclink_project = 'https://bitbucket.org/westurner/sphinxcontrib-srclinks'
#srclink_project = 'hg@bitbucket.org/westurner/sphinxcontrib-srclinks'
#srclink_project = 'git@bitbucket.org/westurner/sphinxcontrib-srclinks'
srclink_src_path = 'docs/'
#srclink_src_path = ''
srclink_branch = 'master'
#srclink_branch = 'develop'
BLD: conf.py: Add srclinks.html to html_sidebars in conf.py:
# Custom sidebar templates, maps document names to template names.
html_sidebars = {
'**': [
'localtoc.html',
'relations.html',
'searchbox.html',
'srclinks.html',
],
'index': [
'globaltoc.html',
'relations.html',
'searchbox.html',
'srclinks.html',
],
}
conf.py examples
License
BSD 3-Clause
Changelog
0.2.4 (2019-04-16)
DOC: Add Python 2 and 3 trove classifiers
0.2.3 (2019-04-16)
BUG: Python 3 Compatibility
0.2.2
ENH: _templates/srclinks.html: add class=’widget navlinks|srclinks
0.2.1
DOC: CHANGELOG.rst
0.2.0
BUG: backwards compatibility with edit_on_github
0.1.2
BLD: MANIFEST.in
0.1.1
DOC: LICENSE
0.1.0
First release as sphinxcontrib.srclinks
ENH: Added BitBucket support (hg@ (default) and git@)
TST: Added tests for BitBucket and GitHub support