html

package
v0.0.0-...-1f40f5c Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"

	h "codeberg.org/FedericoSchonborn/go-sandbox/html"
)

func main() {
	html := h.P(
		"Here is a ",
		h.A("https://go.dev", "link").
			Target(h.TargetBlank),
		", and a ",
		h.Span("span"),
		".",
	)
	fmt.Println(h.Render(html))

}
Output:


<nil>

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(elem Element) error

Types

type AElement

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

func A

func A(href string, children ...any) *AElement

func (*AElement) Render

func (a *AElement) Render() error

func (*AElement) Target

func (a *AElement) Target(target Target) *AElement

type Element

type Element interface {
	Render() error
}

type PElement

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

func P

func P(children ...any) *PElement

func (*PElement) Render

func (p *PElement) Render() error

type SpanElement

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

func Span

func Span(children ...any) *SpanElement

func (*SpanElement) Render

func (span *SpanElement) Render() error

type Target

type Target string
const (
	TargetBlank  Target = "_blank"
	TargetSelf   Target = "_self"
	TargetParent Target = "_parent"
	TargetTop    Target = "_top"
)

Jump to

Keyboard shortcuts

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