Skip to content

Commit

Permalink
markdown2: fix compatibility with pygments 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Apr 24, 2022
1 parent 188347f commit 912c33d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
([#374](https://github.com/mitmproxy/pdoc/issues/374), [@jacksund](https://github.com/jacksund))
- Fix a bug where explicit links were rendered incorrectly.
([#382](https://github.com/mitmproxy/pdoc/issues/382), [@mhils](https://github.com/mhils))
- Fix compatibility with pygments 2.12.
([#384](https://github.com/mitmproxy/pdoc/issues/384), [@mhils](https://github.com/mhils))

# 2022-04-06: pdoc 11.0.0

Expand Down
9 changes: 7 additions & 2 deletions pdoc/markdown2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,9 +1839,14 @@ def _wrap_code(self, inner):
yield tup
yield 0, "</code>"

def wrap(self, source, outfile):
def wrap(self, source, outfile=None):
"""Return the source with a code, pre, and div."""
return self._wrap_div(self._wrap_pre(self._wrap_code(source)))
if outfile is None:
# pygments >= 2.12
return self._wrap_pre(self._wrap_code(source))
else:
# pygments < 2.12
return self._wrap_div(self._wrap_pre(self._wrap_code(source)))

formatter_opts.setdefault("cssclass", "codehilite")
formatter = HtmlCodeFormatter(**formatter_opts)
Expand Down

0 comments on commit 912c33d

Please sign in to comment.