Skip to main content

GitHub source code links and syntax highlighting for Sphinx documentation

Project description

Sphinx GitHub Style: GitHub Integration and Pygments Style for Sphinx Documentation

GitHub source code links and syntax highlighting for Sphinx documentation

Explore the docs »


PyPI Version GitHub Repository https://static.pepy.tech/personalized-badge/sphinx-github-style?period=total&units=none&left_color=grey&right_color=blue&left_text=Downloads Documentation Status

About

sphinx-github-style is a Sphinx extension that links your documentation to GitHub source code. It also adds syntax highlighting for code blocks similar to GitHub’s pretty lights dark theme.

Syntax Highlighting

sphinx-github-style also contains a Pygments style to highlight code blocks similar to GitHub:

A code block highlighted by the Pygments style. It looks identical to GitHub.

Installation

To install using pip:

pip install sphinx-github-style

Configuration

Add the extension to your conf.py

extensions = [
    "sphinx_github_style",
]

Optional Configuration Variables

Add any (or none) of the following configuration variables to your conf.py

linkcode_blob

The blob to link to on GitHub - any of "head", "last_tag", or "{blob}"

Type: str

Default: "head"

  • "head" (default): links to the most recent commit hash; if this commit is tagged, uses the tag instead

  • "last_tag": links to the most recent commit tag on the currently checked out branch

  • "blob": links to any blob you want, for example "master" or "v2.0.1"


linkcode_url

The link to your GitHub repository formatted as https://github.com/user/repo

Type: str

Default: f"https://github.com/{html_context['github_user']}/{html_context['github_repo']}/{html_context['github_version']}"

  • If not provided, will attempt to create the link from the html_context dict


linkcode_link_text

The text to use for the linkcode link

Type: str

Default: "View on GitHub"


linkcode_resolve

A linkcode_resolve() function to use when resolving the link target with sphinx.ext.linkcode

Type: Callable

Default: Return value from get_linkcode_resolve()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-github-style-1.2.2.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

sphinx_github_style-1.2.2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-github-style-1.2.2.tar.gz.

File metadata

  • Download URL: sphinx-github-style-1.2.2.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for sphinx-github-style-1.2.2.tar.gz
Algorithm Hash digest
SHA256 aad6231fcc0a4f59df82531eb3a82dda8a461a94d9e304895c34ac1158d7347c
MD5 c9573bce583b24b9e31eac1edc4b93b6
BLAKE2b-256 0227f0d375d18c45ba795826070e03dd32c13575f3ec4fb7273654e33c12fb08

See more details on using hashes here.

File details

Details for the file sphinx_github_style-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_github_style-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8f6fd1a2c1a5878428a010050549c8353354a1ca9650f6bb01049c649935677d
MD5 c6f8e86058d0c1c04f25da23a2f38dd9
BLAKE2b-256 4f43a1aa363d38363f66a668a286691006c11866a6cb5cc75d7325a17395f337

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page