Result of previous test didn't check for the trailing ' ' that convert_br() adds: This is needed to ensure that the resulting markdown not only has \n for the <br> but also renders it as a newline.
14 lines
522 B
Python
14 lines
522 B
Python
from markdownify import markdownify as md
|
|
|
|
|
|
def test_nested():
|
|
text = md('<p>This is an <a href="http://example.com/">example link</a>.</p>')
|
|
assert text == 'This is an [example link](http://example.com/).\n\n'
|
|
|
|
|
|
def test_code_with_tricky_content():
|
|
assert md('<code>></code>') == "`>`"
|
|
assert md('<code>/home/</code><b>username</b>') == "`/home/`**username**"
|
|
assert md('First line <code>blah blah<br />blah blah</code> second line') \
|
|
== "First line `blah blah \nblah blah` second line"
|