“sourcehighlight”未被识别为内部或外部命令

2024-06-11 23:14:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我在读关于Ascidoc的书。我用python做了一个例子,但每次我试图用html显示一个代码博客,我都会得到一个异常'source-highlight' is not recognized as an internal or external command, operable program or batch file.

Python代码

from asciidocapi import AsciiDocAPI
asciidoc = AsciiDocAPI()
asciidoc.execute('mydoc.txt')

mydoc.txt文件:

== Example
.Optional Title
[source,python]
----
# *Source* block
# Use: highlight code listings
# (require `source-highlight` or `pygmentize`)
python('Hello world')
----

asciidoc.config文件中的source-highlight未被识别为命令


Tags: or文件代码txtsourceishtmlnot
1条回答
网友
1楼 · 发布于 2024-06-11 23:14:23

source-highlighter=source-highlight中的source-highlighter=pygments更改为asciidoc.config

您必须安装pygmentspip install Pygments

我在Ubuntu上进行了测试,更改上述设置之前的错误消息是/bin/sh: 1: source-highlight: not found

相关问题 更多 >