Skip to content

Package sanitize provides functions for sanitizing text in golang strings.

License

Notifications You must be signed in to change notification settings

dutchcoders/sanitize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sanitize

Package sanitize provides functions for sanitizing text in golang strings.

FUNCTIONS

sanitize.HTMLAllowing(s string, args...[]string) (string, error)

Parse html and allow certain tags and attributes from the lists optionally specified by args - args[0] is a list of allowed tags, args[1] is a list of allowed attributes. If either is missing default sets are used.

sanitize.HTML(s string) string

Strip html tags with a very simple parser, replace common entities, and escape < and > in the result. The result is intended to be used as plain text.

sanitize.Accents(text string) string

Replace a set of accented characters with ascii equivalents.

sanitize.Name(text string) string

Makes a string safe to use in a file name (e.g. for saving file atttachments)

sanitize.Path(text string) string

Makes a string safe to use as an url path, cleaned of unsuitable characters

About

Package sanitize provides functions for sanitizing text in golang strings.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%