Sphinx Github Integration and Github Dark Theme Pygments Style
Project description
GitHub source code links and syntax highlighting for Sphinx docs
About
sphinx-github-style is a Sphinx extension that makes your docs look like and link to GitHub
…
GitHub Source Code Links
Using sphinx.ext.linkcode, a View on GitHub link is added to the documentation of every class, method and function:
They link to and highlight the corresponding 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.1b14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5dbcb1f618a258c4c596b8cec982161af0cdc62e3a8df3d109a2e81c427a093 |
|
MD5 | 710e3f813f0f7c1e52032e718ea85d05 |
|
BLAKE2b-256 | eb38754a2a730a86092e318dde23dd39486bcbea4daab5ede0d8cb8a201c7ec2 |
Hashes for sphinx_github_style-0.0.1b14-py3.10.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7bc8b3bde0d9ee3d956202f70e5585ebcb794e190289241ad280dd34406c3e9 |
|
MD5 | 801900dff517ca8577a6eee396c5b6e7 |
|
BLAKE2b-256 | 7616f18ad6478926950b82abf697f177e664da13a6a10397459cf7a55e7b8909 |
Hashes for sphinx_github_style-0.0.1b14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c28058cf67d97a1102b29224ef1f1593d2102db1b87ffb98e79779e2474178d0 |
|
MD5 | bf0b93c477a57cc78f120e9a428292a5 |
|
BLAKE2b-256 | 70121870a9a73de92cd1cd4189e9f05d953bb218d5e8995c4aa28a7a49aae87b |