That extra removed argument did make it "work", but due to the internals
being different, all ANSI output was additionally wrapped in
<div class="highlight">. Now it's not anymore.
class_ = 'm-code'
if isinstance(lexer, ansilexer.AnsiLexer):
- formatter = ansilexer.HtmlAnsiFormatter()
+ formatter = ansilexer.HtmlAnsiFormatter(nowrap=True)
else:
formatter = HtmlFormatter(nowrap=True)
'(?P<Suffix>")'
)
- # Pygments 2.12+ doesn't have the outfile parameter anymore
- def wrap(self, source, outfile=None):
- return self._wrap_code(source)
-
- def _wrap_code(self, source):
- for i, t in source:
+ def _format_lines(self, tokensource):
+ for i, t in HtmlFormatter._format_lines(self, tokensource):
if i == 1: # it's a line of formatted code
t = self._ansi_color_re.sub(self._replace_ansi_class, t)
yield i, t
del options['hl-lines']
if isinstance(lexer, ansilexer.AnsiLexer):
- formatter = ansilexer.HtmlAnsiFormatter(**options)
+ formatter = ansilexer.HtmlAnsiFormatter(nowrap=True, **options)
else:
formatter = HtmlFormatter(nowrap=True, **options)