q

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

	AttrCite = []byte(" cite=\"")
)

Byte constants for HTML rendering.

Functions

func Cited added in v0.3.0

func Cited(str string, cite string) *element

Cited Creates a q element with text content and a citation URL. Uses text.Text which HTML-escapes the output. Example: q.Cited("To be or not to be", "https://example.com/hamlet") Renders: <q cite="https://example.com/hamlet">To be or not to be</q>

func New

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

New Creates a new q element with optional child nodes. Example: q.New(text.Text("To be or not to be")) Renders: <q>To be or not to be</q>

func RawText

func RawText(content string) *element

RawText Creates a new q element with raw text content. Uses text.RawText which is not HTML-escaped. Example: q.RawText("<em>Important</em> quote") Renders: <q><em>Important</em> quote</q>

func RawTextf

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

RawTextf Creates a new q element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: q.RawTextf("<em>%s</em> said it best", author) Renders: <q><em>Orwell</em> said it best</q>

func Static

func Static(content string) *element

Static Creates a new q element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: q.Static("Knowledge is power") Renders: <q>Knowledge is power</q>

func Text

func Text(content string) *element

Text Creates a new q element with text content. Uses text.Text which HTML-escapes the output. Example: q.Text("To be or not to be") Renders: <q>To be or not to be</q>

func Textf

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

Textf Creates a new q element with formatted text content. Uses text.Textf which HTML-escapes the output. Example: q.Textf("%s said it best", author) Renders: <q>Orwell said it best</q>

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