mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-05 16:37:19 -04:00
Check for style being nil in renderText helper
This commit is contained in:
@@ -17,6 +17,8 @@ type BaseElement struct {
|
|||||||
|
|
||||||
func renderText(w io.Writer, rules *ElementStyle, s string) {
|
func renderText(w io.Writer, rules *ElementStyle, s string) {
|
||||||
out := aurora.Reset(s)
|
out := aurora.Reset(s)
|
||||||
|
|
||||||
|
if rules != nil {
|
||||||
if rules.Color != "" {
|
if rules.Color != "" {
|
||||||
i, err := strconv.Atoi(rules.Color)
|
i, err := strconv.Atoi(rules.Color)
|
||||||
if err == nil && i >= 0 && i <= 255 {
|
if err == nil && i >= 0 && i <= 255 {
|
||||||
@@ -51,6 +53,7 @@ func renderText(w io.Writer, rules *ElementStyle, s string) {
|
|||||||
if rules.Blink {
|
if rules.Blink {
|
||||||
out = out.Blink()
|
out = out.Blink()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_, _ = w.Write([]byte(out.String()))
|
_, _ = w.Write([]byte(out.String()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user