htmlutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StripTags

func StripTags(s string) string

StripTags converts HTML to plain text with no live HTML tag in it. It turns block-level tags (p, div, br, etc.) into newlines to preserve paragraph structure, strips the remaining tags, decodes one level of entities, and cleans up whitespace.

Markup that was entity-encoded ("&lt;img ...&gt;") becomes a tag once decoded, so complete tags are stripped again after decoding and any leftover "<" that would open a tag is dropped. Escaped prose such as "a &lt; b" still decodes to "a < b". Deeper encodings ("&amp;lt;b&amp;gt;") decode one level to inert text ("&lt;b&gt;"). The result is plain text, not safe HTML: every consumer that writes it into HTML must still escape it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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