bilibili-backup/vendor/github.com/grokify/html-strip-tags-go
root beccf3fe43 init 2019-04-22 02:59:20 +00:00
..
BUILD.bazel init 2019-04-22 02:59:20 +00:00
LICENSE init 2019-04-22 02:59:20 +00:00
PATENTS init 2019-04-22 02:59:20 +00:00
README.md init 2019-04-22 02:59:20 +00:00
strip.go init 2019-04-22 02:59:20 +00:00

README.md

HTML StripTags for Go

Go Report Card Build Status Docs License

This is a Go package containing an extracted version of the unexported stripTags function in html/template/html.go.

Background

  • The stripTags function in html/template/html.go is very useful, however, it is not exported.
  • Requests were made on GitHub without success.
  • This package is a repo for work done by Christopher Hesse provided in this Gist.

Installation

$ go get github.com/grokify/html-strip-tags-go

Usage

import(
    "github.com/grokify/html-strip-tags-go" // => strip
)

func main() {
    original := "<h1>Hello World</h1>"
    stripped := strip.StripTags(original) // => "Hello World"
}