mirror of https://github.com/CrimsonTome/tldr.git
chroma: update page (#10202)
parent
56c232b361
commit
4ccd83fa92
|
@ -1,16 +1,21 @@
|
||||||
# chroma
|
# 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: <https://github.com/alecthomas/chroma>.
|
> More information: <https://github.com/alecthomas/chroma>.
|
||||||
|
|
||||||
- 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`
|
||||||
|
|
Loading…
Reference in New Issue