python - '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-highlight
在asciidoc.config
文件中不被识别为命令。
解决方案
在你source-highlighter=source-highlight
的.source-highlighter=pygments
asciidoc.config
您必须已pygments
安装 ( pip install Pygments
)。
我已经在 Ubuntu 上进行了测试,更改上述设置之前的错误消息是/bin/sh: 1: source-highlight: not found
.
推荐阅读
- javascript - 悬停在 svg 元素上时尝试隐藏 div 时出现问题
- python - Allauth 不适用于 django 中的 twitch
- java - 使用 Java 运行 Spark 的 cmd 错误“此时 Common 是意外的”
- javascript - 如何让 css-loader 和 style-loader 正常工作以允许我将 CSS 文件与 Webpack 一起使用?
- python - Q: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 0: unexpected end of data
- swift - 在 SwiftUI 视图中插入非列表元素
- graphql - 困惑为什么 returnPartialData 在 Apollo Client 3 中没有字段策略的情况下工作
- selenium-chromedriver - 在 chrome94 上,硒无法定位元素
- python - 如何创建具有 msg 功能的 tkinter Python 聊天应用程序?
- javascript - 尝试在正则表达式掩码后添加字母单词