builders

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeHTML

func EscapeHTML(content string) string

EscapeHTML is a utility function to escape HTML content

func FormatWithLineBreaks

func FormatWithLineBreaks(content string) string

FormatWithLineBreaks converts newlines to HTML line breaks

Types

type HTMLBuilder

type HTMLBuilder struct {
	// contains filtered or unexported fields
}

HTMLBuilder constructs HTML content incrementally.

func NewHTMLBuilder

func NewHTMLBuilder() *HTMLBuilder

NewHTMLBuilder creates a new HTML builder

func (*HTMLBuilder) Build

func (b *HTMLBuilder) Build() string

Build returns the built HTML string

func (*HTMLBuilder) EndElement

func (b *HTMLBuilder) EndElement(tag string)

EndElement ends the current HTML element

func (*HTMLBuilder) EndSpan

func (b *HTMLBuilder) EndSpan()

EndSpan ends the current span element

func (*HTMLBuilder) Len

func (b *HTMLBuilder) Len() int

Len returns the current number of parts in the builder

func (*HTMLBuilder) Raw

func (b *HTMLBuilder) Raw(htmlContent string)

Raw adds raw HTML content (use with caution)

func (*HTMLBuilder) Reset

func (b *HTMLBuilder) Reset()

Reset clears the builder for reuse

func (*HTMLBuilder) StartElement

func (b *HTMLBuilder) StartElement(tag string, attrs map[string]string)

StartElement starts a new HTML element with optional attributes

func (*HTMLBuilder) StartSpan

func (b *HTMLBuilder) StartSpan(classes []string, styles map[string]string)

StartSpan starts a new span element with optional classes and styles

func (*HTMLBuilder) Text

func (b *HTMLBuilder) Text(content string)

Text adds escaped text content

Jump to

Keyboard shortcuts

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