Fix newline start in header tags (#89)
* Fix newline start in header tags
This commit is contained in:
committed by
GitHub
parent
a2f82678f7
commit
f33ccd7c1a
@@ -265,7 +265,7 @@ class MarkdownConverter(object):
|
||||
return text
|
||||
|
||||
style = self.options['heading_style'].lower()
|
||||
text = text.rstrip()
|
||||
text = text.strip()
|
||||
if style == UNDERLINED and n <= 2:
|
||||
line = '=' if n == 1 else '-'
|
||||
return self.underline(text, line)
|
||||
|
||||
@@ -90,6 +90,14 @@ def test_em():
|
||||
inline_tests('em', '*')
|
||||
|
||||
|
||||
def test_header_with_space():
|
||||
assert md('<h3>\n\nHello</h3>') == '### Hello\n\n'
|
||||
assert md('<h4>\n\nHello</h4>') == '#### Hello\n\n'
|
||||
assert md('<h5>\n\nHello</h5>') == '##### Hello\n\n'
|
||||
assert md('<h5>\n\nHello\n\n</h5>') == '##### Hello\n\n'
|
||||
assert md('<h5>\n\nHello \n\n</h5>') == '##### Hello\n\n'
|
||||
|
||||
|
||||
def test_h1():
|
||||
assert md('<h1>Hello</h1>') == 'Hello\n=====\n\n'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user