Added text.Plain helper function

This function was added for convenience.
This commit is contained in:
diamondburned 2020-08-15 14:10:53 -07:00
parent 2f5c86aa60
commit 681cc520d9
1 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,11 @@ type Rich struct {
Segments []Segment
}
// Plain creates a rich text with no formatting.
func Plain(text string) Rich {
return Rich{Content: text}
}
// Empty returns whether or not the rich text is considered empty.
func (r Rich) Empty() bool {
return r.Content == ""