pygments support in hgweb
Adam Hupp
adam at hupp.org
Sun Nov 4 17:55:21 CST 2007
I've modified hgweb to apply pygments syntax highlighting in the file
revision view. It's based on this patch[0] but has the following
improvements:
* uses an external css file instead of inline styles.
* falls back to a plain view if pygments is not available or is disabled
* language determined based on file extension and contents
* supports striped line highlighting
The changes are available in this repo:
http://hupp.org/adam/hg/hg-pygments
That repository is running the changes.
One issue I ran into was an "unloaded module not callable" error
within pygments. This was resolved by adding
mercurial.demandimport.disable() at the top of hgweb_mod.py. That's
probably not the right solution but I'm not sure how else to handle
it.
Is there any interest in including this change in mercurial?
[0] http://www.selenic.com/pipermail/mercurial/2007-May/013207.html
--
Adam Hupp | http://hupp.org/adam/
More information about the Mercurial-devel
mailing list