Python pygmentize 忽略样式选项
Python pygmentize ignores style options
我正在尝试使用 pygments
pygmentize
命令行程序对 Python 3 代码进行语法高亮显示,但它只是忽略了所有样式选项。我尝试了以下方法:
pygmentize -S colorful -l python3 e:\work\Python\repl.py
pygmentize -O style=colorful -l python3 e:\work\Python\repl.py
它返回帮助文本或默认样式。这是在 Windows 10。有人知道我做错了什么吗?
它还 returns 在尝试使用以下方法写出 html 文件时提供帮助:
pygmentize -f html -S colorful -l python3 -o a.html e:\work\Python\repl.py
使用 Pygments 2.11 版,pygmentize --help
说明如下:
-O OPTION=value[,OPTION=value,...]
Give options to the lexer and formatter as a comma-separated list of key-value pairs. Example: `-O bg=light,python=cool`.
-P OPTION=value
Give a single option to the lexer and formatter - with this you can pass options whose value contains commas and equal signs. Example: `-P "heading=Pygments, the Python highlighter"`.
这对我来说并不明显,但我使用了 style
作为一个选项并且它适用于 -O
和 -P
:
pygmentize -O style=colorful -g /etc/hosts
pygmentize -P style=friendly -g /etc/hosts
提醒:要列出可用样式,运行 pygmentize -L styles
我正在尝试使用 pygments
pygmentize
命令行程序对 Python 3 代码进行语法高亮显示,但它只是忽略了所有样式选项。我尝试了以下方法:
pygmentize -S colorful -l python3 e:\work\Python\repl.py
pygmentize -O style=colorful -l python3 e:\work\Python\repl.py
它返回帮助文本或默认样式。这是在 Windows 10。有人知道我做错了什么吗?
它还 returns 在尝试使用以下方法写出 html 文件时提供帮助:
pygmentize -f html -S colorful -l python3 -o a.html e:\work\Python\repl.py
使用 Pygments 2.11 版,pygmentize --help
说明如下:
-O OPTION=value[,OPTION=value,...]
Give options to the lexer and formatter as a comma-separated list of key-value pairs. Example: `-O bg=light,python=cool`.
-P OPTION=value
Give a single option to the lexer and formatter - with this you can pass options whose value contains commas and equal signs. Example: `-P "heading=Pygments, the Python highlighter"`.
这对我来说并不明显,但我使用了 style
作为一个选项并且它适用于 -O
和 -P
:
pygmentize -O style=colorful -g /etc/hosts
pygmentize -P style=friendly -g /etc/hosts
提醒:要列出可用样式,运行 pygmentize -L styles