Skip to content

markdown: Do not add <p> to list items #975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/markdown/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def parse_line(line, in_list):
if not re.match('<h|<ul|<li', res):
res = wrap(res, 'p')

if not re.match('(<ul>)?<li>_(.*)', res):
if list_match is None:
res = re.sub('(.*)(<li>)(.*)(</li>)(.*)', r'\1\2<p>\3</p>\4\5', res)

while check_bold(res):
Expand Down
6 changes: 3 additions & 3 deletions exercises/markdown/markdown_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from markdown import parse_markdown


# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0


class TestMarkdown(unittest.TestCase):
Expand Down Expand Up @@ -37,8 +37,8 @@ def test_h6(self):

def test_unordered_lists(self):
self.assertEqual(parse_markdown('* Item 1\n* Item 2'),
'<ul><li><p>Item 1</p></li>'
'<li><p>Item 2</p></li></ul>')
'<ul><li>Item 1</li>'
'<li>Item 2</li></ul>')

def test_little_bit_of_everything(self):
self.assertEqual(parse_markdown(
Expand Down