trac 的源代码语法高亮?
我已经在 Ubuntu 服务器上安装了 trac
,但没有 php
语法突出显示。
我已经使用 apt-get install 安装了 Pygments,但是如何配置 trac 以便它在 svn 源浏览器中使用突出显示?
I've installed trac
on my Ubuntu server but there is no php
syntax highlighting.
I have installed Pygments
using apt-get install
but how do I configure trac
so it uses highlighting in the svn source browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Trac 应该自动检测 pygments,假设它安装在同一个 Python 实例中。您可能想查看 doc,特别是关于 mimeviewer 部分 的 trac.ini 并确保一切正常。
我能想到的两个最有可能的候选者是:
1)PHP mime 类型未正确注册,或者(更糟糕)您的文件被提交到 svn,并且 svn 属性
svn:mime-type
设置为text/plain
(我在一个大型项目中发生过这种情况,但重置 mime-type 属性有效(如果 VCS 未报告 mimetype,Trac 使用文件扩展名作为后备)。2 )一切可能都正常,但默认样式可能无法正常工作。尝试通过 Trac 实例上的 /prefs 页面或通过 trac.ini 中的 pygments_default_style 设置来调整突出显示样式。
Trac should automatically detect pygments, assuming its installed in the same Python instance. You may want to have a look at the doc, particularly the bit about the mimeviewer section of trac.ini and make sure everything is ok.
The two most likely candidates I can think of are:
1) the PHP mime type is not properly registered or (even worse) your files were committed to svn with the svn property
svn:mime-type
set totext/plain
(I had this happen on a large project, but resetting the mime-type property worked (Trac uses the file extension as a fallback if the mimetype isn't reported by the VCS).2) Everything may be working, but the default style may not be working properly. Try adjusting the highlighting style either through the /prefs page on your Trac instance or through the
pygments_default_style
setting in trac.ini.