text.Rich to implement Stringer; extra docs

This commit is contained in:
diamondburned (Forefront) 2020-06-20 00:10:23 -07:00
parent e953dbbcb1
commit dfb60ac0eb
1 changed files with 6 additions and 0 deletions

View File

@ -7,10 +7,16 @@ type Rich struct {
Segments []Segment
}
// Empty returns whether or not the rich text is considered empty.
func (r Rich) Empty() bool {
return r.Content == ""
}
// String returns the content. This is used mainly for printing.
func (r Rich) String() string {
return r.Content
}
// Segment is the minimum requirement for a format segment. Frontends will use
// this to determine when the format starts and ends. They will also assert this
// interface to any other formatting interface, including Linker, Colorer and