This commit is contained in:
yuin 2022-03-12 17:18:59 +09:00
parent 0af271269f
commit e64a68fc13
2 changed files with 6 additions and 1 deletions

View file

@ -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>
//= = = = = = = = = = = = = = = = = = = = = = = =//

View file

@ -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