Sphinx Github Integration and Github Dark Theme Pygments Style
Project description
Add GitHub source code links and syntax highlighting to your Sphinx documentation
Overview
sphinx-github-style makes your Sphinx documentation link to and look like GitHub
Source Code Links
A "View on GitHub" link will be added to every class, function, and method in your API documentation:
These link to the highlighted code block in your GitHub repo:
📝 Note |
---|
These links can be used with/instead of the links added by sphinx.ext.viewcode
|
Syntax Highlighting
sphinx-github-style also contains a Pygments style to highlight code in your documentation similar to GitHub:
Installation
To install using pip:
pip install sphinx-github-style
Configuration
Add the extension to your conf.py
extensions = [
"sphinx_github_style",
]
…
Configuration Variables
Add any of the following configuration variables to your conf.py
linkcode_blob
linkcode_blob: str = "head"
The blob to link to on GitHub - any of "head", "last_tag", or "{blob}"
head (default): links to the most recent commit hash; if this commit is tagged, uses the tag instead
last_tag: links to the most recently tagged commit; if no tags exist, uses head
blob: links to any blob you want, for example "master" or "v2.0.1"
…
linkcode_url
linkcode_url: str = f"https://github.com/{html_context['github_user']}/{html_context['github_repo']}/{html_context['github_version']}"
The link to your GitHub repository formatted as https://github.com/user/repo
If not provided, will attempt to create the link from the html_context dict
…
linkcode_link_text
linkcode_link_text: str = "View on GitHub"
The text to use for the linkcode link
…
linkcode_resolve
linkcode_resolve: types.FunctionType
A linkcode_resolve() function to use for resolving the link target
Uses default function from get_linkcode_resolve() if not specified (recommended)
Noteworthy Components
TDKStyle - Pygments Style for syntax highlighting similar to Github Pretty Lights Dark Theme
TDKMethLexor - Pygments Lexor to add syntax highlighting to methods
get_linkcode_resolve() - to link to GitHub source code using sphinx.ext.linkcode
add_linkcode_node_class() - adds a new linkcode-link class, allowing for CSS styling separately from viewcode links
github_style.css - CSS styling for linkcode links (icon + text)
Documentation
Full documentation can be found on ReadTheDocs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for sphinx-github-style-0.0.1b11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ef5858b752b42740d4b1b92de112e921163b056bf076d1d501b8e197d50c1f |
|
MD5 | 9e59536654bdba03d168aed9b5a09e78 |
|
BLAKE2b-256 | 55be27a5cf4da8cfff8d204696955390546c550106b58aba5419ed194c9b244d |
Hashes for sphinx_github_style-0.0.1b11-py3.10.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21bc6d6e71bb8e398e73999c32b59db569beb253d38bb7e5024a2b437cf01a9b |
|
MD5 | 396eaa74163a1e857a3aa723999fac6b |
|
BLAKE2b-256 | 6538a79064ddd7a63e47bd2f396338211629b7c50ab4e91decf38b53708bc853 |
Hashes for sphinx_github_style-0.0.1b11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5bbeb574ce190993820e1ca612a91764033e677c45ea931511736890745010b |
|
MD5 | cda4d6342396898dcdfc67081aac6052 |
|
BLAKE2b-256 | 294bf3fcc41a6fa23c7a9ebfc477fcc7bd97619021bd78ba996b09cbe319f335 |