Skip to content

Commit

Permalink
fix: #313
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Jul 18, 2024
1 parent bb80234 commit 49bac14
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
7 changes: 3 additions & 4 deletions ansi/elements.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element {
// Blockquote
case ast.KindBlockquote:
e := &BlockElement{
Block: &bytes.Buffer{},
Style: cascadeStyle(ctx.blockStack.Current().Style, ctx.options.Styles.BlockQuote, false),
Margin: true,
Newline: true,
Block: &bytes.Buffer{},
Style: cascadeStyle(ctx.blockStack.Current().Style, ctx.options.Styles.BlockQuote, false),
Margin: true,
}
return Element{
Entering: "\n",
Expand Down
4 changes: 0 additions & 4 deletions ansi/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ func (r *ANSIRenderer) renderNode(w util.BufWriter, source []byte, node ast.Node
}

func isChild(node ast.Node) bool {
if node.Parent() != nil && node.Parent().Kind() == ast.KindBlockquote {
// skip paragraph within blockquote to avoid reflowing text
return true
}
for n := node.Parent(); n != nil; n = n.Parent() {
// These types are already rendered by their parent
switch n.Kind() {
Expand Down
8 changes: 8 additions & 0 deletions ansi/testdata/TestRendererIssues/313.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

                                                                            
 │ This is a block quote                                                      
 │                                                                            
 │ │ This is the nested quote                                                  
 │                                                                            
 │ This is part of the outer block quote.                                     

5 changes: 5 additions & 0 deletions testdata/issues/313.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
> This is a block quote
>
> > This is the nested quote
>
> This is part of the outer block quote.

0 comments on commit 49bac14

Please sign in to comment.