Skip to content

Commit

Permalink
Merge pull request #209 from benoit-pierre/support_cmarkgfm>=0.6.0
Browse files Browse the repository at this point in the history
support cmarkgfm>=0.6.0
  • Loading branch information
di authored Sep 30, 2021
2 parents 74ea0a6 + 7398c2b commit df8779c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion readme_renderer/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def _highlight(html):
formatter = pygments.formatters.HtmlFormatter(nowrap=True)

code_expr = re.compile(
r'<pre><code class="language-(?P<lang>.+?)">(?P<code>.+?)'
# cmarkgfm<0.6.0: <pre><code class="language-python">print('hello')</code></pre>
# cmarkgfm>=0.6.0: <pre lang="python"><code>print('hello')</code></pre>
r'(<pre>(?P<in_code><code) class="language-|<pre lang=")(?P<lang>[^"]+?)">'
'(?(in_code)|<code>)(?P<code>.+?)'
r'</code></pre>', re.DOTALL)

def replacer(match):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
entry_points={
"distutils.commands": ["check = readme_renderer.integration.distutils:Check"],
},
extras_require={"md": "cmarkgfm>=0.5.0,<0.6.0"},
extras_require={"md": "cmarkgfm>=0.5.0,<0.7.0"},
packages=setuptools.find_packages(exclude=["tests", "tests.*"]),
)

0 comments on commit df8779c

Please sign in to comment.