Documentation
¶
Index ¶
- func FontStyleCSS(fs *rich.Style, tag string, cssProps map[string]any) bool
- func HTMLPreToRich(str []byte, sty *rich.Style, cssProps map[string]any) (rich.Text, error)
- func HTMLToRich(str []byte, sty *rich.Style, cssProps map[string]any) (rich.Text, error)
- func RichToHTML(tx rich.Text) string
- func SubProperties(tag string, cssProps map[string]any) (map[string]any, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FontStyleCSS ¶
FontStyleCSS looks for "tag" name properties in cssProps properties, and applies those to style if found, and returns true -- false if no such tag found
func HTMLPreToRich ¶
HTMLPreToRich translates preformatted HTML-styled text into a rich.Text using given initial text styling parameters and css properties. This uses a custom decoder that preserves all whitespace characters, and decodes all standard inline HTML text style formatting tags in the string. Only basic styling tags, including <span> elements with style parameters (including class names) are decoded. Whitespace is decoded as-is, including LF \n etc, except in WhiteSpacePreLine case which only preserves LF's.
func HTMLToRich ¶
HTMLToRich translates HTML-formatted rich text into a rich.Text, using given initial text styling parameters and css properties. This uses the golang XML decoder system, which strips all whitespace and therefore does not capture any preformatted text. See HTMLPre. cssProps are a list of css key-value pairs that are used to set styling properties for the text, and can include class names with a value of another property map that is applied to elements of that class, including standard elements like a for links, etc.
func RichToHTML ¶
RichToHTML returns an HTML encoded representation of the rich.Text.
Types ¶
This section is empty.