diff -r 4dcc9b5d786a -r c35ee1bbbbdc hgext/highlight/highlight.py --- a/hgext/highlight/highlight.py Mon Aug 03 14:16:51 2015 -0700 +++ b/hgext/highlight/highlight.py Sun Aug 02 19:18:35 2015 +0800 @@ -49,7 +49,12 @@ try: lexer = guess_lexer(text[:1024], stripnl=False) except (ClassNotFound, ValueError): - lexer = TextLexer(stripnl=False) + # Don't highlight unknown files + return + + # Don't highlight text files + if isinstance(lexer, TextLexer): + return formatter = HtmlFormatter(nowrap=True, style=style)