Update renderer to match Misaka 2.0 API
This commit is contained in:
parent
2ce48325c0
commit
4a97cbae90
@ -33,7 +33,7 @@ class TestHTML(unittest.TestCase):
|
||||
self.assertEqual(convert(input), expected)
|
||||
|
||||
def test_github_flavoured_markdown(self):
|
||||
convert = html.Markdown(extensions=("fenced_code", ))
|
||||
convert = html.Markdown(extensions=("fenced-code", ))
|
||||
|
||||
# without lang
|
||||
_in = textwrap.dedent("""\
|
||||
|
@ -59,11 +59,11 @@ def sanitize(tokenizer, document):
|
||||
return serializer.render(stream)
|
||||
|
||||
|
||||
def Markdown(extensions=("strikethrough", "superscript", "autolink")):
|
||||
def Markdown(extensions=("strikethrough", "superscript", "autolink",
|
||||
"fenced-code")):
|
||||
|
||||
flags = reduce(operator.xor, map(
|
||||
lambda ext: getattr(misaka, 'EXT_' + ext.upper()), extensions), 0)
|
||||
md = misaka.Markdown(Unofficial(), extensions=flags)
|
||||
renderer = Unofficial()
|
||||
md = misaka.Markdown(renderer, extensions=extensions)
|
||||
|
||||
def inner(text):
|
||||
rv = md(text).rstrip("\n")
|
||||
@ -82,7 +82,7 @@ class Unofficial(misaka.HtmlRenderer):
|
||||
to <code class="$lang">, compatible with Highlight.js.
|
||||
"""
|
||||
|
||||
def block_code(self, text, lang):
|
||||
def blockcode(self, text, lang):
|
||||
lang = ' class="{0}"'.format(lang) if lang else ''
|
||||
return "<pre><code{1}>{0}</code></pre>\n".format(text, lang)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user