mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-06 08:57:14 -04:00
Handle Lists as a block element, which supports margins & indents
This commit is contained in:
+2
-13
@@ -2,7 +2,6 @@ package gold
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
bf "gopkg.in/russross/blackfriday.v2"
|
||||
)
|
||||
@@ -11,19 +10,9 @@ type ItemElement struct {
|
||||
}
|
||||
|
||||
func (e *ItemElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error {
|
||||
l := 0
|
||||
n := node
|
||||
for n.Parent != nil && (n.Parent.Type == bf.List || n.Parent.Type == bf.Item) {
|
||||
if n.Parent.Type == bf.List {
|
||||
l++
|
||||
}
|
||||
n = n.Parent
|
||||
}
|
||||
|
||||
el := &BaseElement{
|
||||
Prefix: strings.Repeat(" ", l-1),
|
||||
Token: string(node.Literal),
|
||||
Style: Item,
|
||||
Token: string(node.Literal),
|
||||
Style: Item,
|
||||
}
|
||||
return el.Render(w, node, tr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user