htmlutil

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHTMLClayID

func GenerateHTMLClayID() (string, error)

GenerateHTMLClayID generates a UUID v4 using crypto/rand.

func HasHTMLTag

func HasHTMLTag(data []byte) bool

HasHTMLTag reports whether data contains a real top-level <html> start tag, ignoring any <html occurrence inside a comment. Used to reject a save body that is not a full HTML document before it overwrites a file.

func InjectHTMLClayID

func InjectHTMLClayID(data []byte, id string) []byte

InjectHTMLClayID adds htmlclayid to <html> if not already present. This is persistent — never stripped on save.

func InjectToken

func InjectToken(data []byte, value string) []byte

InjectToken injects the htmlclaytoken attribute on <html>. Ephemeral auth token — stripped on save.

func ReadHTMLClayID

func ReadHTMLClayID(data []byte) string

ReadHTMLClayID extracts the htmlclayid UUID from the <html> tag. Returns empty string if not present.

func StripToken

func StripToken(data []byte) []byte

StripToken removes the htmlclaytoken attribute from <html>.

Types

This section is empty.

Jump to

Keyboard shortcuts

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