add figure/figcaption

for #46
This commit is contained in:
AlexVonB
2021-06-30 13:02:36 +02:00
parent 62e9f0de02
commit 828e116530
2 changed files with 14 additions and 0 deletions

View File

@@ -240,6 +240,12 @@ class MarkdownConverter(object):
convert_em = abstract_inline_conversion(lambda self: self.options['strong_em_symbol'])
def convert_figcaption(self, el, text, convert_as_inline):
return "<figcaption>%s</figcaption>" % text
def convert_figure(self, el, text, convert_as_inline):
return "<figure>%s</figure>" % text
convert_kbd = convert_code
def convert_hn(self, n, el, text, convert_as_inline):

View File

@@ -39,6 +39,10 @@ def test_a_no_autolinks():
assert md('<a href="https://google.com">https://google.com</a>', autolinks=False) == '[https://google.com](https://google.com)'
def test_a_containing_images():
assert md('<a href="#"><img src="/path/to/img.jpg"></a>') == '[![](/path/to/img.jpg)](#)'
def test_b():
assert md('<b>Hello</b>') == '**Hello**'
@@ -84,6 +88,10 @@ def test_em():
inline_tests('em', '*')
def test_figure():
assert md('<figure><img src="#"><figcaption>A</figcaption></figure>') == '<figure>![](#)<figcaption>A</figcaption></figure>'
def test_h1():
assert md('<h1>Hello</h1>') == 'Hello\n=====\n\n'