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.1b12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6053fceb79c14760ceaf21932fc70295ef8890fec6fd9d98f5a61a22b28b1e6 |
|
MD5 | eb8907826d217a747763d2df1471fab0 |
|
BLAKE2b-256 | 47bb538db1e52a5cc16a41f068d8c3f743cbebc814e8fbf8cbcfcd3c50474c6d |
Hashes for sphinx_github_style-0.0.1b12-py3.10.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b6307b6327f9571300f6c8afc2021e30a2bac90f7998f5de6cca4fdb6197507 |
|
MD5 | 23408fb33e97fe1f806389eafe1209fe |
|
BLAKE2b-256 | 2c902c2e245718a7af45828cc5cfc96d9fcf023c2e1ae342dd4a8328aa2d23f0 |
Hashes for sphinx_github_style-0.0.1b12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c6f6ae1c68096dc4965166f5800036801370230855e9ef8197e32412ae9f7be |
|
MD5 | 70e9ca480299f40c52f8c20b639e9054 |
|
BLAKE2b-256 | c20aef0fcd64e5b87f5296f35d502bd80c1f92335a79c266ccf7d89050b0f899 |