sanitizer

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sanitize

func Sanitize(baseURL, input string) string

Sanitize returns safe HTML.

func StripTags

func StripTags(input string) string

StripTags removes all HTML/XML tags from the input string. This function must *only* be used for cosmetic purposes, not to prevent code injections like XSS.

func TruncateHTML

func TruncateHTML(input string, max int) string

Types

type ImageCandidate

type ImageCandidate struct {
	ImageURL   string
	Descriptor string
}

type ImageCandidates

type ImageCandidates []*ImageCandidate

func ParseSrcSetAttribute

func ParseSrcSetAttribute(attributeValue string) (imageCandidates ImageCandidates)

ParseSrcSetAttribute returns the list of image candidates from the set. https://html.spec.whatwg.org/#parse-a-srcset-attribute

func (ImageCandidates) String

func (c ImageCandidates) String() string

Jump to

Keyboard shortcuts

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