mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Fix #285
This commit is contained in:
parent
a816d4652e
commit
0af271269f
2 changed files with 12 additions and 1 deletions
|
|
@ -703,3 +703,11 @@ This line will be displayed.
|
||||||
//- - - - - - - - -//
|
//- - - - - - - - -//
|
||||||
<p>\\\ufffd"</p>
|
<p>\\\ufffd"</p>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
|
|
||||||
|
55: inline HTML comment
|
||||||
|
//- - - - - - - - -//
|
||||||
|
a <!-- b --> c
|
||||||
|
//- - - - - - - - -//
|
||||||
|
<p>a <!-- b --> c</p>
|
||||||
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,12 @@ func (s *rawHTMLParser) parseComment(block text.Reader, pc Context) ast.Node {
|
||||||
line = line[offset:]
|
line = line[offset:]
|
||||||
for {
|
for {
|
||||||
hindex := bytes.Index(line, doubleHyphen)
|
hindex := bytes.Index(line, doubleHyphen)
|
||||||
|
if hindex > -1 {
|
||||||
|
hindex += offset
|
||||||
|
}
|
||||||
index := bytes.Index(line, closeComment) + offset
|
index := bytes.Index(line, closeComment) + offset
|
||||||
if index > -1 && hindex == index {
|
if index > -1 && hindex == index {
|
||||||
if index == 0 || line[index-1] != '-' {
|
if index == 0 || len(line) < 2 || line[index-1] != '-' {
|
||||||
node.Segments.Append(segment.WithStop(segment.Start + index + len(closeComment)))
|
node.Segments.Append(segment.WithStop(segment.Start + index + len(closeComment)))
|
||||||
block.Advance(index + len(closeComment))
|
block.Advance(index + len(closeComment))
|
||||||
return node
|
return node
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue