diff --git a/pages/common/chroma.md b/pages/common/chroma.md index bd2acd3e2e..0d22f1ae66 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`