Skip to content

Commit

Permalink
Fix invalid handling of consecutive code spans
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed Dec 2, 2019
1 parent 68dcec6 commit ac8e225
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions _test/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
B</li>
</ul>
//= = = = = = = = = = = = = = = = = = = = = = = =//



2
//- - - - - - - - -//
**test**\
Expand All @@ -20,6 +23,9 @@ test<strong>test</strong><br />
<strong>test</strong>test<br />
test<strong>test</strong></p>
//= = = = = = = = = = = = = = = = = = = = = = = =//



3
//- - - - - - - - -//
>* >
Expand All @@ -39,3 +45,13 @@ test<strong>test</strong></p>
3</p>
</blockquote>
//= = = = = = = = = = = = = = = = = = = = = = = =//



4
//- - - - - - - - -//
`test`a`test`
//- - - - - - - - -//
<p><code>test</code>a<code>test</code></p>
//= = = = = = = = = = = = = = = = = = = = = = = =//

2 changes: 1 addition & 1 deletion parser/code_span.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (s *codeSpanParser) Parse(parent ast.Node, block text.Reader, pc Context) a
for ; i < len(line) && line[i] == '`'; i++ {
}
closure := i - oldi
if closure == opener && (i+1 >= len(line) || line[i+1] != '`') {
if closure == opener && (i >= len(line) || line[i] != '`') {
segment = segment.WithStop(segment.Start + i - closure)
if !segment.IsEmpty() {
node.AppendChild(node, ast.NewRawTextSegment(segment))
Expand Down

0 comments on commit ac8e225

Please sign in to comment.