Make blockquote attention recognize more syntaxes (#31240)

Fix #31214
This commit is contained in:
wxiaoguang 2024-06-04 23:35:29 +08:00 committed by GitHub
parent fcc061ae44
commit bd80225ec3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 87 additions and 20 deletions

View file

@ -31,10 +31,16 @@ func (b *blockParser) Open(parent ast.Node, reader text.Reader, pc parser.Contex
return nil, parser.NoChildren
}
dollars := false
var dollars bool
if b.parseDollars && line[pos] == '$' && line[pos+1] == '$' {
dollars = true
} else if line[pos] != '\\' || line[pos+1] != '[' {
} else if line[pos] == '\\' && line[pos+1] == '[' {
if len(line[pos:]) >= 3 && line[pos+2] == '!' && bytes.Contains(line[pos:], []byte(`\]`)) {
// do not process escaped attention block: "> \[!NOTE\]"
return nil, parser.NoChildren
}
dollars = false
} else {
return nil, parser.NoChildren
}