Skip to content

Commit 901b11d

Browse files
yawpitchpetertseng
authored andcommitted
markdown: unordered lists with surrounding content (exercism#1490)
Adds a tests for unordered lists with surrounding content; many solutions I've seen are not properly closing an unordered list when there's content below the list's final item. Note that there's only a single newline between the final item and the content right after it. Some Markdown parsers seem to parse this as a continuation of the line item rather than ending the list. The Markdown spec does not seem to clearly define this, so we acknowledge this ambiguity. We feel that the choice we make doesn't affect the educational value of the exercise, but does avoid some complexity in a parser.
1 parent ca9c09e commit 901b11d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

exercises/markdown/canonical-data.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"exercise": "markdown",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"comments": [
55
"Markdown is a shorthand for creating HTML from text strings."
66
],
@@ -100,6 +100,14 @@
100100
"markdown": "This is a paragraph with # and * in the text"
101101
},
102102
"expected": "<p>This is a paragraph with # and * in the text</p>"
103+
},
104+
{
105+
"description": "unordered lists close properly with preceding and following lines",
106+
"property": "parse",
107+
"input": {
108+
"markdown": "# Start a list\n* Item 1\n* Item 2\nEnd a list"
109+
},
110+
"expected": "<h1>Start a list</h1><ul><li>Item 1</li><li>Item 2</li></ul><p>End a list</p>"
103111
}
104112
]
105-
}
113+
}

0 commit comments

Comments
 (0)