mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-05 08:27:18 -04:00
Let users define a prefix & suffix for style elements
This commit is contained in:
@@ -31,6 +31,14 @@ func (e *BaseElement) Render(w io.Writer, node *bf.Node, tr *TermRenderer) error
|
|||||||
fmt.Fprintf(w, "%s", e.Token)
|
fmt.Fprintf(w, "%s", e.Token)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if rules.Prefix != "" {
|
||||||
|
fmt.Fprintf(w, "%s", rules.Prefix)
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if rules.Suffix != "" {
|
||||||
|
fmt.Fprintf(w, "%s", rules.Suffix)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
out := aurora.Reset(e.Token)
|
out := aurora.Reset(e.Token)
|
||||||
if rules.Color != "" {
|
if rules.Color != "" {
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ type ElementStyle struct {
|
|||||||
Inverse bool `json:"inverse"`
|
Inverse bool `json:"inverse"`
|
||||||
Blink bool `json:"blink"`
|
Blink bool `json:"blink"`
|
||||||
Theme string `json:"theme"`
|
Theme string `json:"theme"`
|
||||||
|
Prefix string `json:"prefix"`
|
||||||
|
Suffix string `json:"suffix"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func keyToType(key string) (StyleType, error) {
|
func keyToType(key string) (StyleType, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user