2017-04-17 19:03:00 +01:00
|
|
|
# pygmentize
|
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
> Python-based syntax highlighter.
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
- Highlight file syntax and print to standard output (language is inferred from the file extension):
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-04-24 07:33:27 +01:00
|
|
|
`pygmentize {{file.py}}`
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
- Explicitly set the language for syntax highlighting:
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
`pygmentize -l {{javascript}} {{input_file}}`
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
- List available lexers (processors for input languages):
|
2017-04-17 19:03:00 +01:00
|
|
|
|
|
|
|
`pygmentize -L lexers`
|
|
|
|
|
2017-04-24 17:23:05 +01:00
|
|
|
- Save output to a file in HTML format:
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
`pygmentize -f html -o {{output_file.html}} {{input_file.py}}`
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
- List available output formats:
|
2017-04-17 19:03:00 +01:00
|
|
|
|
|
|
|
`pygmentize -L formatters`
|
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
- Output an HTML file, with additional formatter options (full page, with line numbers):
|
2017-04-17 19:03:00 +01:00
|
|
|
|
2017-05-03 20:54:49 +01:00
|
|
|
`pygmentize -f html -O "full,linenos=True" -o {{output_file.html}} {{input_file}}`
|