Skip to content

adamchainz/pygments-git

Repository files navigation

pygments-git

image

image

image

image

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.8 to 3.12 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.

About

Pygments lexers for Git output and files

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •