Skip to main content

Bootstrap-style status badges for Sphinx documentation

Project description

sphinx-badges

Bootstrap-style status badges for Sphinx documentation.

Attach coloured badges to any API element, and let readers filter a toctree by badge group with a single click.

PyPI version Ruff Ruff Format

Documentation

Installation

Directly from GitHub (latest development version):

pip install git+https://github.com/NickGeneva/sphinx-badges.git

Quick start

  1. Add the extension to conf.py:

    extensions = ["sphinx_badges"]
    
  2. Define grouped badges in conf.py:

    badges_group_labels = {
        "stability": "Stability",
        "area":      "Area",
    }
    
    badges_definitions = {
        "stability:stable":       {"label": "Stable",       "color": "#198754", "text_color": "#fff"},
        "stability:experimental": {"label": "Experimental", "color": "#ffc107", "text_color": "#000"},
        "area:core":              {"label": "Core",         "color": "#6f42c1", "text_color": "#fff"},
        "area:utils":             {"label": "Utils",        "color": "#fd7e14", "text_color": "#fff"},
    }
    

    Badge IDs use a group:name format. badges_group_labels maps group keys to the display labels shown above each row of filter buttons. Ungrouped IDs (no colon) are also supported for simpler setups.

  3. Attach badges to a page:

    my_function
    ===========
    
    .. badges:: stability:stable area:core
    
    Description here.  Also inline: :badge:`stability:stable`.
    
  4. Filter a toctree by badge group:

    .. badge-filter:: stability:stable stability:experimental area:core area:utils
       :filter-mode: or
    
       .. toctree::
    
          api/module_a
          api/module_b
    

    Each group renders as its own labelled row of filter buttons. filter-mode can be or (any active badge matches) or and (all active badges must match; default).

Licence

MIT

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_badges-0.1.0.tar.gz (89.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_badges-0.1.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_badges-0.1.0.tar.gz.

File metadata

  • Download URL: sphinx_badges-0.1.0.tar.gz
  • Upload date:
  • Size: 89.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_badges-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9f2335b3ceda0ad675282dfe3780ca7254aaed9a7efbd16739022949e5d0bcd
MD5 f8ebc0ace8a8cfa96e5293b4ef6146d2
BLAKE2b-256 474f9294ba90a9fc7d06392ae95b03675daed23f9503f22a9e1d3b0e588aaf4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_badges-0.1.0.tar.gz:

Publisher: publish.yml on NickGeneva/sphinx-badges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_badges-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sphinx_badges-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_badges-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 180c97443de0d73e7a48285e9110ac23f193e258e61791adf65ab7b2b1a82351
MD5 a1eeb22af51febace65aaed48286375a
BLAKE2b-256 9aa919e1c482b0361851ec5afb2032251b6da51d45a5703c7c637d95c89711b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_badges-0.1.0-py3-none-any.whl:

Publisher: publish.yml on NickGeneva/sphinx-badges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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