Pygments Shell Console
Pygments lexers for shell console sessions: highlighted prompts and git output.
Install
pip install pygments-shell-console
Usage
Use the shellconsole lexer with the shellconsole-style style:
pygmentize -l shellconsole -O style=shellconsole-style session.txt
In Markdown (MkDocs, Sphinx...), use shellconsole as the code block language:
```shellconsole
user@host:~/project (main) $ git status
```
Prompt
The prompt elements are highlighted separately:
(venv) user@host:~/project (main) $
Virtualenv, user@host, directory and git branch. Also supported:
- Root prompts (
root@host:~#) and[user@host ~]style prompts. - Continuation lines: backslash, trailing
|,&&or||, and here-documents.
Output
The output lexer is chosen from the command. sudo and git global options
(-C dir, --no-pager...) are skipped.
| Command | Lexer | Alias |
|---|---|---|
diff, git diff, git stash show -p |
DiffLexer |
|
git status |
GitStatusLexer |
git-status |
git status -s, --porcelain |
GitShortStatusLexer |
git-short-status |
git show |
GitShowLexer |
git-show |
git log, --oneline, -p |
GitLogLexer |
git-log |
git lg*, git log --graph |
GitPrettyLogLexer |
git-pretty-log |
git branch |
GitBranchLexer |
git-branch |
git merge, pull, stash show, diff --stat |
GitMergeLexer |
git-merge |
any other git command |
GitLexer |
git |
The git lexers can also be used on their own through their alias.
git lg* expects this format:
log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
More examples: mkdocs-material-joapuiib.
Development
pip install -e '.[test]'
pytest
Metadata
Release files for pygments-shell-console 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pygments_shell_console-0.9.0.tar.gz | 65.4 kB | With provenance | Details for pygments_shell_console-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygments_shell_console-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for pygments_shell_console-0.9.0-py3-none-any.whl |
Total release size: 74.0 kB
Release files / pygments_shell_console-0.9.0.tar.gz
| Download URL | pygments_shell_console-0.9.0.tar.gz |
|---|---|
| Size | 65.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19d7f1b7edf7a2645cb57320dacfb14b728da45d75a24749ff706a07a1b596ff
|
|
BLAKE2b-256 checksum How to use checksums |
41f34cb1f2d2bfbda14024b80535c9d001dfe2c29b335b1ad77d75e45f0c565a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logRelease files / pygments_shell_console-0.9.0-py3-none-any.whl
| Download URL | pygments_shell_console-0.9.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80c5c52b8c3cd690a555b4776ab1efff20051900768b81b42613b8b47cb32849
|
|
BLAKE2b-256 checksum How to use checksums |
aee2dca9742e1c5dc4d315bd0a29eb304ed69e4280a08121d81a6ad3e50be165
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logSecurity for pygments-shell-console 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pygments_shell_console-0.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.