Highlight Extension

This extension is currently being distributed along with Mercurial.

Original author: Adam Hupp


This extension does syntax highlighting in hgweb.

The extension depends on having Pygments installed.


Configure your .hgrc to change the Pygments style:

highlight =

pygments_style = <style> (default: colorful)
highlightfiles = <fileset> (default: size('<5M'))
highlightonlymatchfilename = <bool> (default False)

To limit files to consider highlighting, specify them in highlightfiles using a fileset.

By default, Pygments is asked to guess file type even if extension is not recognized, by looking at file contents. The result may not always be accurate, and highlightonlymatchfilename set to True should help with that (see 7a3f6490ef97).

If you're having troubles with `pygments_style`

Mercurial 1.1 and above no longer needs this:

A workaround to generate the appropriate theme CSS for your mercurial installation:

$ pygmentize -f html -S emacs > /usr/local/lib/python2.4/site-packages/mercurial/templates/static/highlight.css 


HighlightExtension (last edited 2017-01-02 10:35:57 by AntonShestakov)