Skip to content

Commit

Permalink
Fix #287
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed Mar 12, 2022
1 parent 0af2712 commit e64a68f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions _test/extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,11 @@ This line will be displayed.
55: inline HTML comment
//- - - - - - - - -//
a <!-- b --> c

a <!-- b -->
//- - - - - - - - -//
<p>a <!-- b --> c</p>
<p>a <!-- b --></p>
//= = = = = = = = = = = = = = = = = = = = = = = =//


2 changes: 1 addition & 1 deletion parser/raw_html.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (s *rawHTMLParser) parseComment(block text.Reader, pc Context) ast.Node {
}
index := bytes.Index(line, closeComment) + offset
if index > -1 && hindex == index {
if index == 0 || len(line) < 2 || line[index-1] != '-' {
if index == 0 || len(line) < 2 || line[index-offset-1] != '-' {
node.Segments.Append(segment.WithStop(segment.Start + index + len(closeComment)))
block.Advance(index + len(closeComment))
return node
Expand Down

0 comments on commit e64a68f

Please sign in to comment.