Commits

Anonymous committed de60286

handle line numbers in HtmlFormatter and not just in css. Quite a few text browsers ignore the display:none property and as such don't hide the linenumbers properly. They do now. Fixes #7

Comments (0)

Files changed (1)

lodgeit/lib/highlighting.py

 _escaped_marker = re.compile(r'^\\(?=###)(?m)')
 
 
-def highlight(code, language, _preview=False):
+def highlight(code, language, _preview=False, _linenos=True):
     """Highlight a given code to HTML."""
     if not _preview:
         if language == 'diff':
         except ClassNotFound:
             lexer = TextLexer()
     style = get_style(name_only=True)
-    formatter = HtmlFormatter(linenos=True, cssclass='syntax', style=style)
+    formatter = HtmlFormatter(linenos=_linenos, cssclass='syntax', style=style)
     return u'<div class="code">%s</div>' % \
            pygments.highlight(code, lexer, formatter)