vec

package
v0.0.0-...-c858694 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package vec provides a vecty-like API for backend HTML rendering.

Index

Constants

View Source
const HTMLNode html.NodeType = 100

HTMLNode represents a node type whose Data is raw HTML.

Variables

This section is empty.

Functions

func Apply

func Apply(h *HTML, m MarkupOrComponentOrHTML)

func Render

func Render(w io.Writer, c Component) error

func RenderHTML

func RenderHTML(w io.Writer, hs ...*HTML) error

Types

type Component

type Component interface {
	Render() *HTML
}

type HTML

type HTML struct {
	Type       html.NodeType // One of html.ElementNode, html.TextNode, HTMLNode.
	DataAtom   atom.Atom     // Used when Type is html.ElementNode.
	Data       string        // Used when Type is html.TextNode or HTMLNode.
	Attributes map[atom.Atom]string

	Children  []*HTML
	Children2 []*html.Node // TODO: Generalize to/merge with all children. Currently, this is optional nodes after children.
}

func UnsafeHTML

func UnsafeHTML(html string) *HTML

type Markup

type Markup func(h *HTML)

type MarkupOrComponentOrHTML

type MarkupOrComponentOrHTML interface{}

Directories

Path Synopsis
Package attr defines functions to set attributes of an HTML node.
Package attr defines functions to set attributes of an HTML node.
Package elem defines functions to create HTML elements.
Package elem defines functions to create HTML elements.

Jump to

Keyboard shortcuts

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