From 7b6dd4ff600b20d243e729c23200f38b47e27d77 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 27 Mar 2024 15:36:21 +0800 Subject: [PATCH 1/2] Fix bug for markdown rendering of blockquote --- modules/markup/markdown/transform_blockquote.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/markup/markdown/transform_blockquote.go b/modules/markup/markdown/transform_blockquote.go index d685cfd1c5a4..c9bf35054703 100644 --- a/modules/markup/markdown/transform_blockquote.go +++ b/modules/markup/markdown/transform_blockquote.go @@ -23,9 +23,15 @@ func (g *ASTTransformer) transformBlockquote(v *ast.Blockquote, reader text.Read return ast.WalkContinue, nil } node1, ok1 := firstParagraph.FirstChild().(*ast.Text) + if !ok1 { + return ast.WalkContinue, nil + } node2, ok2 := node1.NextSibling().(*ast.Text) + if !ok2 { + return ast.WalkContinue, nil + } node3, ok3 := node2.NextSibling().(*ast.Text) - if !ok1 || !ok2 || !ok3 { + if !ok3 { return ast.WalkContinue, nil } val1 := string(node1.Segment.Value(reader.Source())) From e5cccaa6d2d3f1429f832644ada66c850fbbaba3 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 27 Mar 2024 16:23:58 +0800 Subject: [PATCH 2/2] Update transform_blockquote.go --- modules/markup/markdown/transform_blockquote.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/markup/markdown/transform_blockquote.go b/modules/markup/markdown/transform_blockquote.go index c9bf35054703..65b735e83b95 100644 --- a/modules/markup/markdown/transform_blockquote.go +++ b/modules/markup/markdown/transform_blockquote.go @@ -22,16 +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) - if !ok1 { + node1, ok := firstParagraph.FirstChild().(*ast.Text) + if !ok { return ast.WalkContinue, nil } - node2, ok2 := node1.NextSibling().(*ast.Text) - if !ok2 { + node2, ok := node1.NextSibling().(*ast.Text) + if !ok { return ast.WalkContinue, nil } - node3, ok3 := node2.NextSibling().(*ast.Text) - if !ok3 { + node3, ok := node2.NextSibling().(*ast.Text) + if !ok { return ast.WalkContinue, nil } val1 := string(node1.Segment.Value(reader.Source()))