mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 21:32:41 +08:00
blockquote: Fix invalid access
This commit is contained in:
parent
d5c41f6f1f
commit
33e5d1ff19
@ -118,13 +118,12 @@ func ParseBlockQuoteType(node ast.Node, source []byte) BlockQuoteType {
|
||||
// Classifying the next text type node (midNode) will confirm that.
|
||||
if t == None {
|
||||
midNode := node.NextSibling()
|
||||
rightNode := midNode.NextSibling()
|
||||
|
||||
if midNode.Kind() == ast.KindText {
|
||||
if midNode != nil && midNode.Kind() == ast.KindText {
|
||||
rightNode := midNode.NextSibling()
|
||||
midTextNode := midNode.(*ast.Text)
|
||||
if rightNode != nil && rightNode.Kind() == ast.KindText {
|
||||
rightTextNode := rightNode.(*ast.Text)
|
||||
|
||||
if string(n.Text(source)) == "[" && string(rightTextNode.Text(source)) == "]" {
|
||||
t = ghAlertsClassifier.ClassifyingBlockQuote(string(midTextNode.Text(source)))
|
||||
}
|
||||
|
4
testdata/quotes-droph1.html
vendored
4
testdata/quotes-droph1.html
vendored
@ -98,3 +98,7 @@ b</p>
|
||||
<blockquote>
|
||||
<p>[NOTE]</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Thingy!
|
||||
More stuff</p>
|
||||
</blockquote>
|
||||
|
3
testdata/quotes-stripnewlines.html
vendored
3
testdata/quotes-stripnewlines.html
vendored
@ -96,3 +96,6 @@
|
||||
<blockquote>
|
||||
<p>[NOTE]</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Thingy! More stuff</p>
|
||||
</blockquote>
|
||||
|
4
testdata/quotes.html
vendored
4
testdata/quotes.html
vendored
@ -99,3 +99,7 @@ b</p>
|
||||
<blockquote>
|
||||
<p>[NOTE]</p>
|
||||
</blockquote>
|
||||
<blockquote>
|
||||
<p><strong>TL;DR:</strong> Thingy!
|
||||
More stuff</p>
|
||||
</blockquote>
|
||||
|
5
testdata/quotes.md
vendored
5
testdata/quotes.md
vendored
@ -88,3 +88,8 @@
|
||||
> [Hey !NOTE]
|
||||
|
||||
> [NOTE]
|
||||
|
||||
|
||||
|
||||
> **TL;DR:** Thingy!
|
||||
> More stuff
|
||||
|
Loading…
x
Reference in New Issue
Block a user