diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-03-27 17:09:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 17:09:25 +0800 |
commit | 400bb7ced48eb344d75512a1f7f51dc4c69471df (patch) | |
tree | 3897cd0821de2b968da691628558cd34f802fe41 /modules | |
parent | 4640441a0e23e40bc9ad73ca60f8ade0f29950ee (diff) | |
download | gitea-400bb7ced48eb344d75512a1f7f51dc4c69471df.tar.gz gitea-400bb7ced48eb344d75512a1f7f51dc4c69471df.zip |
Fix bug for markdown rendering of blockquote (#30130)
Caused by #29984
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/markup/markdown/transform_blockquote.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/markup/markdown/transform_blockquote.go b/modules/markup/markdown/transform_blockquote.go index d685cfd1c5..65b735e83b 100644 --- a/modules/markup/markdown/transform_blockquote.go +++ b/modules/markup/markdown/transform_blockquote.go @@ -22,10 +22,16 @@ func (g *ASTTransformer) transformBlockquote(v *ast.Blockquote, reader text.Read if firstParagraph.ChildCount() < 3 { return ast.WalkContinue, nil } - node1, ok1 := firstParagraph.FirstChild().(*ast.Text) - node2, ok2 := node1.NextSibling().(*ast.Text) - node3, ok3 := node2.NextSibling().(*ast.Text) - if !ok1 || !ok2 || !ok3 { + node1, ok := firstParagraph.FirstChild().(*ast.Text) + if !ok { + return ast.WalkContinue, nil + } + node2, ok := node1.NextSibling().(*ast.Text) + if !ok { + return ast.WalkContinue, nil + } + node3, ok := node2.NextSibling().(*ast.Text) + if !ok { return ast.WalkContinue, nil } val1 := string(node1.Segment.Value(reader.Source())) |