Files
tldr/pages.zh/common/pygmentize.md

28 lines
747 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# pygmentize
> 基于Python的语法高亮工具。
> 更多信息请访问:<https://pygments.org/docs/cmdline/>.
- 高亮文件语法并输出到`stdout`(语言从文件扩展名推断):
`pygmentize {{file.py}}`
- 明确设置语法高亮的语言:
`pygmentize -l {{javascript}} {{input_file}}`
- 列出可用的词法分析器(输入语言的处理器):
`pygmentize -L lexers`
- 将输出保存为HTML格式的文件
`pygmentize -f html -o {{output_file.html}} {{input_file.py}}`
- 列出可用的输出格式:
`pygmentize -L formatters`
- 输出一个HTML文件并带有额外的格式选项完整页面带行号
`pygmentize -f html -O "full,linenos=True" -o {{output_file.html}} {{input_file}}`