From 4ccd83fa927c16c5eef606571616ed2e98034577 Mon Sep 17 00:00:00 2001 From: Lena <126529524+acuteenvy@users.noreply.github.com> Date: Wed, 17 May 2023 17:55:34 +0200 Subject: [PATCH] chroma: update page (#10202) --- pages/common/chroma.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pages/common/chroma.md b/pages/common/chroma.md index bd2acd3e2..0d22f1ae6 100644 --- a/pages/common/chroma.md +++ b/pages/common/chroma.md @@ -1,16 +1,21 @@ # chroma -> Chroma is a general-purpose syntax highlighting library and corresponding command, for Go. +> A general-purpose syntax highlighter. +> The `--lexer` option is usually unnecessary, as it will be automatically determined based on the file extension. > More information: . -- Highlight a source file with Python lexer and output to terminal: +- Highlight source code from a file with the Python lexer and output to `stdout`: -`chroma --lexer="{{python}}" {{source_file}}` +`chroma --lexer {{python}} {{path/to/source_file.py}}` -- Highlight a source file with the Go lexer and output to an HTML file: +- Highlight source code from a file with the Go lexer and output to an HTML file: -`chroma --lexer="{{go}}" --formatter="{{html}}" {{source_file}} > {{html_file}}` +`chroma --lexer {{go}} --formatter {{html}} {{path/to/source_file.go}} > {{path/to/target_file.html}}` -- Highlight a source file with the C++ lexer and output to an SVG, using the Monokai style: +- Highlight source code from `stdin` with the C++ lexer and output to an SVG file, using the Monokai style: -`chroma --lexer="{{c++}}" --formatter="{{svg}}" --style="{{monokai}}" {{source_file}} > {{svg_file}}` +`{{command}} | chroma --lexer {{c++}} --formatter {{svg}} --style {{monokai}} > {{path/to/target_file.svg}}` + +- List available lexers, styles and formatters: + +`chroma --list`