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. This is particulary useful if you're editing your sphinx / jupyterbook / teachbook in GitHub, making use of GitHub alerts and the markdown previewer of GitHub. Your Sphinx project will look similar to the preview in GitHub for these GitHub alerts.
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_github_alerts",...]
Configuration
The extension provides several configuration values, which can be added to your configuration file:
sphinx_github_alerts_backquotes:3(default) orinteger: (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) orinteger: (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) ordict: 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
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_github_alerts-1.1.tar.gz.
File metadata
- Download URL: sphinx_github_alerts-1.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e3065e613b089e6e86821927f70cf4b7af92b038854c693ef44e495cf76121f
|
|
| MD5 |
105842df8e17ad26fe44f6e423583395
|
|
| BLAKE2b-256 |
da6b38ecddb6faa15a8ca359afcabaa728df66a2559a68e98851bdc38adbd898
|
Provenance
The following attestation bundles were made for sphinx_github_alerts-1.1.tar.gz:
Publisher:
python-publish.yml on TeachBooks/Sphinx-GitHub-Alerts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_github_alerts-1.1.tar.gz -
Subject digest:
6e3065e613b089e6e86821927f70cf4b7af92b038854c693ef44e495cf76121f - Sigstore transparency entry: 1337679973
- Sigstore integration time:
-
Permalink:
TeachBooks/Sphinx-GitHub-Alerts@332a1525d7d71af67e6520a8ceb591656631cdef -
Branch / Tag:
refs/tags/v1.1 - Owner: https://github.com/TeachBooks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@332a1525d7d71af67e6520a8ceb591656631cdef -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinx_github_alerts-1.1-py3-none-any.whl.
File metadata
- Download URL: sphinx_github_alerts-1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57ff740d461c1670386c40aa4dd1e42794b5b7d48eabb6889b680ef1a17a1602
|
|
| MD5 |
475c0da0038d48e601db64e6a4c0ed6f
|
|
| BLAKE2b-256 |
19a5ec4c322063caff100c15415a48facc1501083e81ebf7a01426c1167d63bc
|
Provenance
The following attestation bundles were made for sphinx_github_alerts-1.1-py3-none-any.whl:
Publisher:
python-publish.yml on TeachBooks/Sphinx-GitHub-Alerts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_github_alerts-1.1-py3-none-any.whl -
Subject digest:
57ff740d461c1670386c40aa4dd1e42794b5b7d48eabb6889b680ef1a17a1602 - Sigstore transparency entry: 1337680048
- Sigstore integration time:
-
Permalink:
TeachBooks/Sphinx-GitHub-Alerts@332a1525d7d71af67e6520a8ceb591656631cdef -
Branch / Tag:
refs/tags/v1.1 - Owner: https://github.com/TeachBooks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@332a1525d7d71af67e6520a8ceb591656631cdef -
Trigger Event:
push
-
Statement type: