sanitizehtml

package
v0.0.0-...-a0a3655 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sanitizehtml implements a sanitizer of a very limited HTML. See Sanitize comment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sanitize

func Sanitize(w io.Writer, r io.Reader) (err error)

Sanitize strips all HTML nodes except allowed ones.

Unless explicitly specified, attributes are stripped. Allowed elements:

  • p, br
  • strong, em
  • a
  • if href attribute is not a valid absolute HTTP(s) link, it is replaced with an innocuous one.
  • alt attribute is allowed
  • ul, ol, li

Elements <script> and <style> are ignored entirely. For all other HTML nodes, Sanitize ignores the node, but visits its children.

Types

This section is empty.

Jump to

Keyboard shortcuts

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