Sphinx Github Integration and Github Dark Theme Pygments Style
Project description
sphinx-github-style
sphinx-github-style
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.1b10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 583ec6f01f324f73e4fa4ac82eadd7d6cd6a8152cdbbe5f2459aaeb1c32d9e67 |
|
MD5 | d9decac5170317aec9dc78238a212651 |
|
BLAKE2b-256 | 4a0b9307e1f226cd8ee8846b01c3c58b6a18e65d4dead43579e5c3c0bfff45b8 |
Hashes for sphinx_github_style-0.0.1b10-py3.10.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 585f8c172dcac1c67c815136f8ea73ab65100a7d3d1d26da92eb01e0a4a2d1ee |
|
MD5 | c5c42940d9c4e520e7cfd665c44953f1 |
|
BLAKE2b-256 | 346dccaff02534afee03ebd60692d46e727b9315b4c4b67474f317dcd0a0afdf |
Hashes for sphinx_github_style-0.0.1b10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 164c431d98e9dfad0c01fe830dd7595473c620f2f86949f6d4a5c3c33fe3c3b4 |
|
MD5 | bd88b817a0287ead893faac20420734b |
|
BLAKE2b-256 | c93db2448609c7a4a535799e8e93aeeb792f2667a18cf9c3412f05028e841d22 |