mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-05 16:37:19 -04:00
Support margin style flag
This commit is contained in:
@@ -49,6 +49,7 @@ type ElementStyle struct {
|
||||
Inverse bool `json:"inverse"`
|
||||
Blink bool `json:"blink"`
|
||||
Indent uint `json:"indent"`
|
||||
Margin uint `json:"margin"`
|
||||
Theme string `json:"theme"`
|
||||
Prefix string `json:"prefix"`
|
||||
Suffix string `json:"suffix"`
|
||||
@@ -83,6 +84,19 @@ func (s StyleStack) Indent() uint {
|
||||
return i
|
||||
}
|
||||
|
||||
func (s StyleStack) Margin() uint {
|
||||
var i uint
|
||||
|
||||
for _, v := range s {
|
||||
if v == nil {
|
||||
continue
|
||||
}
|
||||
i += v.Margin
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
func (s StyleStack) Parent() *ElementStyle {
|
||||
if len(s) < 2 {
|
||||
return s.Current()
|
||||
|
||||
Reference in New Issue
Block a user