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

29 lines
755 B
Markdown
Raw Normal View History

2017-04-17 20:03:00 +02:00
# pygmentize
> Python-based syntax highlighter.
> More information: <https://pygments.org/docs/cmdline/>.
2017-04-17 20:03:00 +02:00
- Highlight file syntax and print to `stdout` (language is inferred from the file extension):
2017-04-17 20:03:00 +02:00
`pygmentize {{file.py}}`
2017-04-17 20:03:00 +02:00
- Explicitly set the language for syntax highlighting:
2017-04-17 20:03:00 +02:00
`pygmentize -l {{javascript}} {{input_file}}`
2017-04-17 20:03:00 +02:00
- List available lexers (processors for input languages):
2017-04-17 20:03:00 +02:00
`pygmentize -L lexers`
2017-04-24 18:23:05 +02:00
- Save output to a file in HTML format:
2017-04-17 20:03:00 +02:00
`pygmentize -f html -o {{output_file.html}} {{input_file.py}}`
2017-04-17 20:03:00 +02:00
- List available output formats:
2017-04-17 20:03:00 +02:00
`pygmentize -L formatters`
- Output an HTML file, with additional formatter options (full page, with line numbers):
2017-04-17 20:03:00 +02:00
`pygmentize -f html -O "full,linenos=True" -o {{output_file.html}} {{input_file}}`