html

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fragment

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

Fragment Creates an html fragment without DOCTYPE declaration (for fragments or embedded use) Example: html.Fragment() Renders: <html></html>

func FragmentRawText

func FragmentRawText(str string) *element

FragmentRawText Creates an html fragment without DOCTYPE declaration with raw text content Example: html.FragmentRawText("<body>Content</body>") Renders: <html><body>Content</body></html>

func FragmentRawTextf

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

FragmentRawTextf Creates an html fragment without DOCTYPE declaration with formatted raw text content as unescaped HTML using text.RawTextf Example: html.FragmentRawTextf("Hello <em>%s</em>", "World") Renders: <html>Hello <em>World</em></html>

func FragmentStatic

func FragmentStatic(str string) *element

FragmentStatic Creates an html fragment without DOCTYPE declaration with static text content Example: html.FragmentStatic("Hello World") Renders: <html>Hello World</html>

func FragmentText

func FragmentText(str string) *element

FragmentText Creates an html fragment without DOCTYPE declaration with text content Example: html.FragmentText("Content") Renders: <html>Content</html>

func FragmentTextf

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

FragmentTextf Creates an html fragment without DOCTYPE declaration with formatted text content using text.Textf Example: html.FragmentTextf("Hello %s", "World") Renders: <html>Hello World</html>

func New

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

New Creates a complete HTML5 document with DOCTYPE declaration Example: html.New() Renders: <!DOCTYPE html><html></html>

func RawText

func RawText(str string) *element

RawText Creates a complete HTML5 document with DOCTYPE declaration and raw text content Example: html.RawText("<body>Content</body>") Renders: <!DOCTYPE html><html><body>Content</body></html>

func RawTextf

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

RawTextf Creates a complete HTML5 document with DOCTYPE declaration and formatted raw text content as unescaped HTML using text.RawTextf Example: html.RawTextf("Hello <em>%s</em>", "World") Renders: <!DOCTYPE html><html>Hello <em>World</em></html>

func Static

func Static(str string) *element

Static Creates a complete HTML5 document with DOCTYPE declaration and static text content Example: html.Static("Hello World") Renders: <!DOCTYPE html><html>Hello World</html>

func Text

func Text(str string) *element

Text Creates a complete HTML5 document with DOCTYPE declaration and text content Example: html.Text("Content") Renders: <!DOCTYPE html><html>Content</html>

func Textf

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

Textf Creates a complete HTML5 document with DOCTYPE declaration and formatted text content using text.Textf Example: html.Textf("Hello %s", "World") Renders: <!DOCTYPE html><html>Hello World</html>

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