rt

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package rt provides constructors and methods for the HTML <rt> element.

The <rt> HTML element specifies the ruby text component of a ruby annotation, which is used to provide pronunciation, translation, or transliteration information for East Asian typography.

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<rt")
	TagClose = []byte("</rt>")
)

Byte constants for HTML rendering.

Functions

func New

func New(nodes ...node.Node) *element

New creates a new rt element with optional child nodes Example: rt.New(text.Text("kan")) Renders: <rt>kan</rt>

func RawText

func RawText(content string) *element

RawText creates a new rt element with raw text content. Uses text.RawText which is not HTML-escaped. Example: rt.RawText("<em>reading</em>") Renders: <rt><em>reading</em></rt>

func RawTextf

func RawTextf(format string, args ...any) *element

RawTextf creates a new rt element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: rt.RawTextf("<span>%s</span>", reading) Renders: <rt><span>かん</span></rt>

func Static

func Static(content string) *element

Static creates a new rt element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: rt.Static("かん") Renders: <rt>かん</rt>

func Text

func Text(content string) *element

Text creates a new rt element with text content. Uses text.Text which HTML-escapes the output. Example: rt.Text("ふりがな") Renders: <rt>ふりがな</rt>

func Textf

func Textf(format string, args ...any) *element

Textf creates a new rt element with formatted text content. Uses text.Textf which HTML-escapes the output. Example: rt.Textf("%s", reading) Renders: <rt>かん</rt>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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