Skip to content

Commit

Permalink
Merge pull request #18229 from MichaelHatherly/mh/list-no-blanks
Browse files Browse the repository at this point in the history
Don't require blank line before markdown lists
  • Loading branch information
MichaelHatherly authored Aug 27, 2016
2 parents 2961c4d + d8da082 commit c20a8bc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/markdown/Common/block.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ isordered(list::List) = list.ordered >= 0
const BULLETS = r"^ {0,3}(\*|\+|-)( |$)"
const NUM_OR_BULLETS = r"^ {0,3}(\*|\+|-|\d+(\.|\)))( |$)"

@breaking true ->
function list(stream::IO, block::MD)
withstream(stream) do
bullet = startswith(stream, NUM_OR_BULLETS; eat = false)
Expand Down
27 changes: 27 additions & 0 deletions test/markdown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,33 @@ let doc = md"""
@test doc.content[2].items[3][1].content[1] == "zombie"
end

let doc = Markdown.parse(
"""
A paragraph...
- one
- two
* three
* four
... another paragraph.
"""
)

@test length(doc.content) === 3
@test isa(doc.content[1], Markdown.Paragraph)
@test isa(doc.content[2], Markdown.List)
@test isa(doc.content[3], Markdown.Paragraph)

@test length(doc.content[2].items) === 2
@test doc.content[2].items[1][1].content[1] == "one"
@test length(doc.content[2].items[2]) == 2
@test doc.content[2].items[2][1].content[1] == "two"

@test isa(doc.content[2].items[2][2], Markdown.List)
@test length(doc.content[2].items[2][2].items) === 2
@test doc.content[2].items[2][2].items[1][1].content[1] == "three"
@test doc.content[2].items[2][2].items[2][1].content[1] == "four"
end

@test md"Foo [bar]" == MD(Paragraph("Foo [bar]"))
@test md"Foo [bar](baz)" != MD(Paragraph("Foo [bar](baz)"))
@test md"Foo \[bar](baz)" == MD(Paragraph("Foo [bar](baz)"))
Expand Down

0 comments on commit c20a8bc

Please sign in to comment.