--- a/setup.py Sun May 17 03:09:49 2020 -0500
+++ b/setup.py Sun May 17 04:27:45 2020 -0500
@@ -15,7 +15,7 @@
package_data={'mercurial.templates': ['static/*']},
# skip mercurial because it might be installed on the system
--- a/src/hgwebplus.py Sun May 17 03:09:49 2020 -0500
+++ b/src/hgwebplus.py Sun May 17 04:27:45 2020 -0500
@@ -33,6 +33,9 @@
+from mistune.directives import DirectiveToc templatefilter = registrar.templatefilter(filters)
@@ -249,11 +252,11 @@
ctx = context.resource(mapping, b'ctx')
- class Renderer(mistune.Renderer):
- def image(self, src, title, alt_text):
- real_src = 'rawfile/%s/%s' % (ctx.rev(), src)
- real_title = title or ''
- return '<img src="%s" alt="%s">%s</img>' % (real_src, alt_text, real_title)
+ class Renderer(mistune.HTMLRenderer): + def image(self, src, alt, title): + src = 'rawfile/%s/%s' % (ctx.rev(), src) + return super().image(src, alt, title) # we iterate the files instead of a fileset, because we want to
# deterministically render readmes in the same order if there are more
@@ -264,7 +267,21 @@
if lower in [b'readme.txt', b'readme', b'readme.md']:
raw_utf8 = ctx[filename].data().decode('utf-8')
- return mistune.markdown(raw_utf8, renderer=Renderer()).encode('utf-8')
+ markdown = mistune.create_markdown( + return markdown(raw_utf8).encode('utf-8')