htmlstrip.go 420 B

123456789101112131415
  1. /*
  2. Package striphtmltags strips HTML tags from strings.
  3. */
  4. package striphtmltags // import "github.com/denisbrodbeck/striphtmltags"
  5. import "github.com/denisbrodbeck/striphtmltags/html/template"
  6. // StripTags takes a snippet of HTML and returns only the text content.
  7. //
  8. // For example, `<b>&iexcl;Hi!</b> <script>...</script>` -> `&iexcl;Hi! `.
  9. func StripTags(html string) string {
  10. return template.StripTags(html)
  11. }