del

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<del")
	TagClose = []byte("</del>")

	AttrCite     = []byte(" cite=\"")
	AttrDateTime = []byte(" datetime=\"")
)

Byte constants for HTML rendering.

Functions

func Cited added in v0.3.0

func Cited(str string, cite string) *element

Cited Creates a del element with text content and a URL documenting the reason for the deletion. Uses text.Text which HTML-escapes the output. Example: del.Cited("removed paragraph", "/changelog#v2.1") Renders: <del cite="/changelog#v2.1">removed paragraph</del>

func Dated added in v0.3.0

func Dated(str string, datetime string) *element

Dated Creates a del element with text content and a timestamp indicating when the deletion occurred. Uses text.Text which HTML-escapes the output. Example: del.Dated("old price: $50", "2024-01-15") Renders: <del datetime="2024-01-15">old price: $50</del>

func Full added in v0.3.0

func Full(str string, cite string, datetime string) *element

Full Creates a del element with text content, a citation URL, and a timestamp. Use when recording both why and when content was deleted. Uses text.Text which HTML-escapes the output. Example: del.Full("old price: $50", "/changelog", "2024-01-15") Renders: <del cite="/changelog" datetime="2024-01-15">old price: $50</del>

func New

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

New Creates a new del element with optional child nodes. Example: del.New() Renders: <del></del>

func RawText

func RawText(str string) *element

RawText Creates a new del element with raw text content. Uses text.RawText which is not HTML-escaped. Example: del.RawText("<s>old price: $50</s>") Renders: <del><s>old price: $50</s></del>

func RawTextf

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

RawTextf Creates a new del element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: del.RawTextf("<s>%s</s>", oldText) Renders: <del><s>removed</s></del>

func Static

func Static(str string) *element

Static Creates a new del element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: del.Static("This feature has been removed.") Renders: <del>This feature has been removed.</del>

func Text

func Text(str string) *element

Text Creates a new del element with text content. Uses text.Text which HTML-escapes the output. Example: del.Text("This text was deleted") Renders: <del>This text was deleted</del>

func Textf

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

Textf Creates a new del element with formatted text content. Uses text.Textf which HTML-escapes the output. Example: del.Textf("price: $%d", oldPrice) Renders: <del>price: $50</del>

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