首页 > 解决方案 > 'source-highlight' 未被识别为内部或外部命令

问题描述

我正在阅读有关 asciidoc 的信息。我在 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')
----

source-highlightasciidoc.config文件中不被识别为命令。

标签: pythonhtmlasciidoc

解决方案


在你source-highlighter=source-highlight的.source-highlighter=pygmentsasciidoc.config

您必须已pygments安装 ( pip install Pygments)。

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


推荐阅读