Skip to main content

Pygments lexers for Git output and files.

Project description

https://img.shields.io/github/actions/workflow/status/adamchainz/pygments-git/main.yml.svg?branch=main&style=for-the-badge https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge https://img.shields.io/pypi/v/pygments-git.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

Pygments lexers for Git output and files.


Get better at command line Git with my book Boost Your Git DX.


Installation

Use pip:

python -m pip install pygments-git

Python 3.9 to 3.13 supported.

Usage

With the package installed, Pygments will autodiscover the below lexers.

When using Pygments directly, you can refer to them by name. Within Sphinx/docutils, you can refer to them in code-block directives:

.. code-block:: git-console

    $ git log --oneline
    82fbbd3 D'oh! Fix math proof
    91e9879 Aye carumba! Grammar mistake
    61c4c08 Cowabunga! Update bibliography

To preview the lexers, open the tests/index.html file within the repository.

git-attributes

A lexer for .gitattributes files.

git-blame-ignore-revs

A lexer for the file format used by blame.ignoreRevsFile. The de facto name for a repository-wide ignore file is .git-blame-ignore-revs, as recognized by GitHub and potentially other Git hosting services.

git-commit-edit-msg

A lexer for the COMMIT_EDITMSG file that Git opens when you run git commit. It calls out to DiffLexer for highlighting any diff, as added by git commit --verbose.

git-conflict-markers

A lexer for the conflict markers that Git adds to indicate conflicts during a merge. All other text in the file is lexed as plain text.

git-console

A lexer for interactive shell sessions with Git. It calls out to BashLexer for highlighting commands on lines starting with a $ and DiffLexer for highlighting inline diffs.

git-ignore

A lexer for .gitignore files.

git-rebase-todo

A lexer for the git-rebase-todo file that Git opens when you run git rebase --interactive. It calls out to BashLexer for highlighting commands on lines starting with x or exerc a $ and DiffLexer for highlighting inline diffs.

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

pygments_git-1.8.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

pygments_git-1.8.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pygments_git-1.8.0.tar.gz.

File metadata

  • Download URL: pygments_git-1.8.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pygments_git-1.8.0.tar.gz
Algorithm Hash digest
SHA256 c1a784dfd8ceff04aecff86cc579a70733a271e1b77c852f6ffa8ae54cff8d2d
MD5 0bf4ef37ba278cc1dbd800c933075d35
BLAKE2b-256 ff9ee54e5a9bb49686b5da2b7d312235c673cebbb9ad0ed92f9c4ff0f7769a97

See more details on using hashes here.

File details

Details for the file pygments_git-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: pygments_git-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pygments_git-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5eb2048f3856904948ac9821c8e8948e58ed4c5ead1321af857f9a61920ca4e4
MD5 26fd0793994ac6dcde7ac7ce8446e0ca
BLAKE2b-256 9c435f3c95eacd1131f384f197d270d7a63599f4748eccdd3405da9cbc8a2388

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