markup

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseColor

func ParseColor(s string) (sg.Color, error)

ParseColor parses a color string in any supported format: hex 6-digit (#3A7AFE), hex 8-digit (#3A7AFE80), hex 3-digit (#38F), rgba(r,g,b,a), rgb(r,g,b), or named (white, black, transparent).

Types

type Outline

type Outline struct {
	Color     sg.Color
	Thickness float64
}

Outline defines a text stroke rendered behind the fill.

type TextSpan

type TextSpan struct {
	Text          string
	Source        *sg.FontFamily // nil = inherit from RichText
	Bold          bool
	Italic        bool
	Color         sg.Color // used when ColorSet == true
	ColorSet      bool     // false = inherit
	Outline       *Outline // nil = inherit; &Outline{} = explicitly none
	Underline     bool
	Strikethrough bool
	SizeOverride  float64 // 0 = inherit displaySize
	LinkURL       string  // non-empty = clickable
	Indent        float64 // left indent for this line and wrapped continuations
}

TextSpan represents a styled segment of text within a RichText component. Fields left at their zero values inherit from the parent RichText.

func ParseMarkup

func ParseMarkup(input string, source *sg.FontFamily, baseSize float64, headingScale [3]float64) ([]TextSpan, error)

ParseMarkup parses XML-like markup into TextSpan slices. Supported tags: b, i, u, strike, color, size, outline, span, link, br, h1, h2, h3, ul, ol, li. The source parameter is accepted but not used during parsing; font resolution is deferred to render time via the RichText source.

Jump to

Keyboard shortcuts

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