Skip to content

Commit

Permalink
Fixes #111
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed Mar 8, 2020
1 parent 2143794 commit 5ab7c64
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 14 deletions.
28 changes: 28 additions & 0 deletions _test/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,31 @@ correctly</a></p>
//- - - - - - - - -//
<p><a href="www.das-dass.de">daß</a> is the old german spelling of <a href="www.das-dass.de">dass</a></p>
//= = = = = = = = = = = = = = = = = = = = = = = =//



10
//- - - - - - - - -//
1. First step.

~~~
aaa
---
bbb
~~~

2. few other steps.
//- - - - - - - - -//
<ol>
<li>
<p>First step.</p>
<pre><code>aaa
---
bbb
</code></pre>
</li>
<li>
<p>few other steps.</p>
</li>
</ol>
//= = = = = = = = = = = = = = = = = = = = = = = =//
29 changes: 15 additions & 14 deletions parser/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,6 @@ func (b *listParser) Continue(node ast.Node, reader text.Reader, pc Context) Sta
}
return Continue | HasChildren
}
// Thematic Breaks take precedence over lists
if isThematicBreak(line, reader.LineOffset()) {
isHeading := false
last := pc.LastOpenedBlock().Node
if ast.IsParagraph(last) {
c, ok := matchesSetextHeadingBar(line)
if ok && c == '-' {
isHeading = true
}
}
if !isHeading {
return Close
}
}

// "offset" means a width that bar indicates.
// - aaaaaaaa
Expand All @@ -200,6 +186,21 @@ func (b *listParser) Continue(node ast.Node, reader text.Reader, pc Context) Sta
if !list.CanContinue(marker, typ == orderedList) {
return Close
}
// Thematic Breaks take precedence over lists
if isThematicBreak(line[match[3]-1:], 0) {
isHeading := false
last := pc.LastOpenedBlock().Node
if ast.IsParagraph(last) {
c, ok := matchesSetextHeadingBar(line)
if ok && c == '-' {
isHeading = true
}
}
if !isHeading {
return Close
}
}

return Continue | HasChildren
}
}
Expand Down

0 comments on commit 5ab7c64

Please sign in to comment.