text

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindLinkHandler

func BindLinkHandler(tview *gtk.TextView, onURL func(string))

BindLinkHandler binds input handlers for triggering hyperlinks within the TextView.

Types

type EmbeddedURL

type EmbeddedURL struct {
	From int    `json:"1"`
	To   int    `json:"2"`
	URL  string `json:"u"`
}

EmbeddedURL is a type that describes a URL and its bounds within a text buffer.

func ParseEmbeddedURL

func ParseEmbeddedURL(data string) (EmbeddedURL, bool)

ParseEmbeddedURL parses the inlined data into an embedded URL structure.

func (*EmbeddedURL) Bounds

func (e *EmbeddedURL) Bounds(buf *gtk.TextBuffer) (start, end *gtk.TextIter)

Bounds returns the bound iterators from the given text buffer.

type Opts added in v0.1.3

type Opts struct {
	// SkipReply, if true, will skip rendering all mx-reply tags.
	SkipReply bool
}

Opts is the options for rendering.

type RenderMetadata

type RenderMetadata struct {
	// RefID is the ID to the message that the current message is a reply to, or
	// empty if there isn't one.
	RefID matrix.EventID
	// URLs is the list of valid URLs in the message. It is used for generating
	// rich embeds.
	URLs []string
}

RenderMetadata contains additional metadata that the message contains.

type RenderWidget

type RenderWidget struct {
	RenderWidgetter
	RenderMetadata
}

RenderWidget describes the output of the render including the widget that contains the rendered information.

func RenderHTML

func RenderHTML(
	ctx context.Context, text, html string, roomID matrix.RoomID, o Opts) RenderWidget

RenderHTML tries rendering the HTML and falls back to using plain text if the HTML doesn't work.

func RenderText

func RenderText(ctx context.Context, text string) RenderWidget

RenderText renders the given plain text.

type RenderWidgetter

type RenderWidgetter interface {
	gtk.Widgetter
	SetExtraMenu(model gio.MenuModeller)
}

RenderWidgetter extends a Widgetter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL