Skip to main content

This Sphinx extension converts GitHub alerts to Sphinx admonitions.

Project description

Sphinx GitHub Alerts

Introduction

This Sphinx extension converts GitHub alerts to Sphinx admonitions.

What does it do?

This extension allows you to use GitHub alerts within your Sphinx project.

Only top-level alerts are allowed and are convert to a top-level admonition in the language (MD or rST) of the source file. The source file does not change.

Nesting is not supported.

If an alert is not recognised, a warning is returned.

Installation

To use this extension, follow these steps:

Step 1: Install the Package

Install the module sphinx-github-alerts package using pip:

pip install sphinx-github-alerts

Step 2: Add to requirements.txt

Make sure that the package is included in your project's requirements.txt to track the dependency:

sphinx-github-alerts

Step 3: Enable in _config.yml or conf.py

In your _config.yml file, add the extension to the list of Sphinx extra extensions (important: underscore, not dash this time):

sphinx: 
    extra_extensions:
        .
        .
        .
        - sphinx_github_alerts
        .
        .
        .

or in your conf.py file, add the extension to the extensions list and specify the location of your bib file:

extensions = [...,"sphinx_apa_references",...]

Configuration

The extension provides several configuration values, which can be added to your configuration file:

  • sphinx_github_alerts_backquotes: 3 (default) or integer: (only relevant for MarkDown based files) The number of backticks used to start and end the admonitions. Should be at minimum 3.
  • sphinx_github_alerts_leading_spaces: 3 (default) or integer: (only relevant for reStructeredText based files) The number of spaces for indentation within the admonitions. Should be at minimum 1.
  • sphinx_github_alerts_redirects: {} (default) or dict: Every key-value pair in this dictionary redirects the GitHub alert indicated by key to the Sphinx admonition indicated by value.

Examples

For each of the five GitHub alerts, you can see the result below. Note that the result depends on where you are visiting this page.

The codes contain a leading space to enforce showing the code and not converting the code. In any application these leading spaces should not be present.

Note

 > [!NOTE]
 > Useful information that users should know, even when skimming content.

[!NOTE] Useful information that users should know, even when skimming content.

Tip

 > [!TIP]
 > Helpful advice for doing things better or more easily.

[!TIP] Helpful advice for doing things better or more easily.

Important

 > [!IMPORTANT]
 > Key information users need to know to achieve their goal.

[!IMPORTANT] Key information users need to know to achieve their goal.

Warning

 > [!WARNING]
 > Urgent info that needs immediate user attention to avoid problems.

[!WARNING] Urgent info that needs immediate user attention to avoid problems.

Caution

 > [!CAUTION]
 > Advises about risks or negative outcomes of certain actions.
 >
 > But multiline alerts can also be used.

[!CAUTION] Advises about risks or negative outcomes of certain actions.

But multiline alerts can also be used.

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_alerts-1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

sphinx_github_alerts-1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_github_alerts-1.0.tar.gz.

File metadata

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

File hashes

Hashes for sphinx_github_alerts-1.0.tar.gz
Algorithm Hash digest
SHA256 cd4d42ae847159e5756213cd249901426a6347cc0387374e63e1f88620d17bc5
MD5 38d42c0190d4875a77e8efff262bf42f
BLAKE2b-256 0b30813be9b002a7ad3c085b6fb25a834cb00a6cc3b55b2ee499d54676366b4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_github_alerts-1.0.tar.gz:

Publisher: python-publish.yml on TeachBooks/Sphinx-GitHub-Alerts

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_github_alerts-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_github_alerts-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7756b6abbd8a5e11efbcfef31ebc3a68c98d4f175dc0f6d3d172dae363e41e92
MD5 4b377f957b243957655fcffc8c1df81a
BLAKE2b-256 3a46b971719ecf14930f8d9407aba8bb70acf0ce37731267ee031b1c372b529a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_github_alerts-1.0-py3-none-any.whl:

Publisher: python-publish.yml on TeachBooks/Sphinx-GitHub-Alerts

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