html

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package html defines lightweight HTML node structures and rendering utilities used by the Markdown renderer.

This package is independent of Markdown semantics and contains only HTML-specific representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w Writable) (string, error)

Render writes w to a string and returns the result.

Types

type Attributes

type Attributes map[string]string

Attributes represents a set of HTML element attributes.

func (Attributes) SortedKeys

func (a Attributes) SortedKeys() []string

SortedKeys returns the attribute keys in deterministic order.

func (Attributes) Write

func (a Attributes) Write(w io.Writer) error

Write serializes attributes to w in key-sorted order.

Values are HTML-escaped before being written.

type Element

type Element struct {
	Tag      string
	Attr     Attributes
	Children []Node
}

func (Element) Write

func (e Element) Write(w io.Writer) error

type Fragment

type Fragment struct {
	Children []Node
}

Fragment is a container node that renders its children in sequence without introducing additional markup.

func (Fragment) Write

func (f Fragment) Write(w io.Writer) error

type Node

type Node interface {
	Write(io.Writer) error
	// contains filtered or unexported methods
}

Node represents a renderable HTML node.

type Raw

type Raw struct {
	Value string
}

Raw represents unescaped HTML content.

func (Raw) Write

func (r Raw) Write(w io.Writer) error

type Text

type Text struct {
	Value string
}

Text represents escaped text content.

func (Text) Write

func (t Text) Write(w io.Writer) error

type VoidElement

type VoidElement struct {
	Tag  string
	Attr Attributes
}

func (VoidElement) Write

func (ve VoidElement) Write(w io.Writer) error

type Writable

type Writable interface {
	Write(io.Writer) error
}

Writable is implemented by values that can serialize themselves to an io.Writer.

Jump to

Keyboard shortcuts

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