import "fyne.io/fyne/v2/widget"
  

Usage

type RichText

  type RichText struct {
	BaseWidget
	Segments []RichTextSegment
	Wrapping fyne.TextWrap
	Scroll   fyne.ScrollDirection

	// The truncation mode of the text
	//
	// Since: 2.4
	Truncation fyne.TextTruncation
}
  

RichText represents the base element for a rich text-based widget.

Since: 2.1

func NewRichText

  func NewRichText(segments ...RichTextSegment) *RichText
  

NewRichText returns a new RichText widget that renders the given text and segments. If no segments are specified it will be converted to a single segment using the default text settings.

Since: 2.1

func NewRichTextFromMarkdown

  func NewRichTextFromMarkdown(content string) *RichText
  

NewRichTextFromMarkdown configures a RichText widget by parsing the provided markdown content.

Since: 2.1

func NewRichTextWithText

  func NewRichTextWithText(text string) *RichText
  

NewRichTextWithText returns a new RichText widget that renders the given text. The string will be converted to a single text segment using the default text settings.

Since: 2.1

func (*RichText) AppendMarkdown

  func (t *RichText) AppendMarkdown(content string)
  

AppendMarkdown parses the given markdown string and appends the content to the widget, with the appropriate formatting. This API is intended for appending complete markdown documents or standalone fragments, and should not be used to parse a single markdown document piecewise.

Since: 2.5

func (*RichText) CreateRenderer

  func (t *RichText) CreateRenderer() fyne.WidgetRenderer
  

CreateRenderer is a private method to Fyne which links this widget to its renderer

func (*RichText) MinSize

  func (t *RichText) MinSize() fyne.Size
  

MinSize calculates the minimum size of a rich text widget. This is based on the contained text with a standard amount of padding added.

func (*RichText) ParseMarkdown

  func (t *RichText) ParseMarkdown(content string)
  

ParseMarkdown allows setting the content of this RichText widget from a markdown string. It will replace the content of this widget similarly to SetText, but with the appropriate formatting.

func (*RichText) Refresh

  func (t *RichText) Refresh()
  

Refresh triggers a redraw of the rich text.

func (*RichText) Resize

  func (t *RichText) Resize(size fyne.Size)
  

Resize sets a new size for the rich text. This should only be called if it is not in a container with a layout manager.

func (*RichText) String

  func (t *RichText) String() string
  

String returns the text widget buffer as string