1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/pygmentize.md
Agniva De Sarker d49b95fc53 Simplify pygmentize
- Simplify main description
- Mentioning that language is inferred from file extension
- Giving a concrete example for another lexer.
2017-04-28 08:28:19 +01:00

626 B

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}}