Publish post 'Add a Pygments Lexer to Chroma' #2

Merged
ccm merged 6 commits from ccm-chroma-post into trunk 2025-06-22 16:56:46 +00:00
2 changed files with 11 additions and 7 deletions
Showing only changes of commit 357462cc19 - Show all commits

1
html/.gitignore vendored
View File

@ -2,6 +2,7 @@ app.css
code.html
index.html
pandoc.css
posts/add-a-pygments-lexer-to-chroma.html
posts/build-a-neovim-qt-appimage-from-source.html
posts/build-static-website-generator-part-1.html
posts/deploy-elixir-generated-html-with-docker-on-digitalocean.html

View File

@ -14,14 +14,18 @@ $index
## Introduction
[Gitea](https://github.com/go-gitea/gitea) uses [Chroma](https://github.com/alecthomas/chroma) for syntax highlighting. Chroma is based on the Python
syntax highlighter, [Pygments](https://github.com/pygments/pygments), and includes a [script](https://github.com/alecthomas/chroma/blob/484750a96fc430f49d6b69cc2a2a8b7a67691446/_tools/pygments2chroma_xml.py) to help convert Pygments
lexers for use with Chroma. We describe how below.
[Gitea][8] uses [Chroma][9] for syntax highlighting. Chroma is based on the
Python syntax highlighter, [Pygments][10], and includes a [script][11] to help
convert Pygments lexers for use with Chroma. We describe how below.
[8]: https://github.com/go-gitea/gitea
[9]: https://github.com/alecthomas/chroma
[10]: https://github.com/pygments/pygments
[11]: https://github.com/alecthomas/chroma/blob/484750a96fc430f49d6b69cc2a2a8b7a67691446/_tools/pygments2chroma_xml.py
## Setup
We're going to be using the `python` and `golang` [Docker][4] images. Docker
We're going to be using the `python` and `golang` [Docker][3] images. Docker
Desktop is _not_ required.
```console
@ -35,10 +39,9 @@ Let's set up some aliases to make running the commands easier.
$ alias docker-run='docker run --rm -it -w /opt -v $PWD:/opt'
$ alias docker-run-go='docker-run golang'
$ alias docker-run-py='docker-run python'
```
```
[3]: https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
[4]: https://docs.docker.com/engine/
[3]: https://docs.docker.com/engine/
## Convert a Pygments lexer to a Chroma lexer with `pygments2chroma_xml.py`