From e64a68fc130e0c74dd2cbec59e6737a2e2bb7398 Mon Sep 17 00:00:00 2001 From: yuin Date: Sat, 12 Mar 2022 17:18:59 +0900 Subject: [PATCH] Fix #287 --- _test/extra.txt | 5 +++++ parser/raw_html.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_test/extra.txt b/_test/extra.txt index 09c1a5d..0998118 100644 --- a/_test/extra.txt +++ b/_test/extra.txt @@ -708,6 +708,11 @@ This line will be displayed. 55: inline HTML comment //- - - - - - - - -// a c + +a //- - - - - - - - -//

a c

+

a

//= = = = = = = = = = = = = = = = = = = = = = = =// + + diff --git a/parser/raw_html.go b/parser/raw_html.go index 133c906..55b9a99 100644 --- a/parser/raw_html.go +++ b/parser/raw_html.go @@ -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