mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00

- Simplify main description - Mentioning that language is inferred from file extension - Giving a concrete example for another lexer.
27 lines
626 B
Markdown
27 lines
626 B
Markdown
# pygmentize
|
|
|
|
> Python based syntax highlighter.
|
|
|
|
- Highlight file syntax and print to standard output. Language is inferred from the file extension:
|
|
|
|
`pygmentize {{file.py}}`
|
|
|
|
- Highlight syntax for a given language:
|
|
|
|
`pygmentize -l {{javascript}} {{javascript_file}}`
|
|
|
|
- Show avaliable lexers:
|
|
|
|
`pygmentize -L lexers`
|
|
|
|
- Redirect output to a file in html format:
|
|
|
|
`pygmentize -f html -o {{file.html}} {{file.py}}`
|
|
|
|
- Show avaliable output formats:
|
|
|
|
`pygmentize -L formatters`
|
|
|
|
- Output to HTML file with line numbers, specifying a given language:
|
|
|
|
`pygmentize -f html -O linenos=1 -l {{language}} -o {{file.html}} {{file}}`
|