Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grokify/html-strip-tags-go
export stripTags from html/template as strip.StripTags
https://github.com/grokify/html-strip-tags-go
golang html utilities
Last synced: about 24 hours ago
JSON representation
export stripTags from html/template as strip.StripTags
- Host: GitHub
- URL: https://github.com/grokify/html-strip-tags-go
- Owner: grokify
- License: bsd-3-clause
- Created: 2016-11-20T08:28:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-19T15:34:30.000Z (about 1 year ago)
- Last Synced: 2024-11-20T02:43:13.020Z (22 days ago)
- Topics: golang, html, utilities
- Language: Go
- Homepage:
- Size: 98.6 KB
- Stars: 139
- Watchers: 4
- Forks: 35
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- go-awesome - html-strip-tags-go - Strip HTML tags (Open source library / Word Processing)
README
HTML StripTags for Go
=====================[![Used By][used-by-svg]][used-by-link]
[![Build Status][build-status-svg]][build-status-link]
[![Go Report Card][goreport-svg]][goreport-link]
[![Docs][docs-godoc-svg]][docs-godoc-link]
[![License][license-svg]][license-link]This is a Go package containing an extracted version of the unexported `stripTags` function in `html/template/html.go`.
:warning: This package does not protect against untrusted input. Please use [bluemonday](https://github.com/microcosm-cc/bluemonday) if you have untrusted data :warning:
## Background
* The `stripTags` function in `html/template/html.go` is very useful, however, it is not exported.
* Requests were made [on GitHub](https://github.com/golang/go/issues/5884) without success.
* This package is a repo for work done by [Christopher Hesse](https://github.com/christopherhesse) provided in this [Gist](https://gist.github.com/christopherhesse/d422447a086d373a967f).## Installation
```bash
$ go get github.com/grokify/html-strip-tags-go
```## Usage
```go
import(
"github.com/grokify/html-strip-tags-go" // => strip
)func main() {
original := "Hello World
"
stripped := strip.StripTags(original) // => "Hello World"
}
```[used-by-svg]: https://sourcegraph.com/github.com/grokify/html-strip-tags-go/-/badge.svg
[used-by-link]: https://sourcegraph.com/github.com/grokify/html-strip-tags-go?badge
[goreport-svg]: https://goreportcard.com/badge/github.com/grokify/html-strip-tags-go
[goreport-link]: https://goreportcard.com/report/github.com/grokify/html-strip-tags-go
[build-status-svg]: https://github.com/grokify/html-strip-tags-go/workflows/test/badge.svg
[build-status-link]: https://github.com/grokify/html-strip-tags-go/actions
[coverage-status-svg]: https://coveralls.io/repos/grokify/html-strip-tags-go/badge.svg?branch=master
[coverage-status-link]: https://coveralls.io/r/grokify/html-strip-tags-go?branch=master
[codeclimate-status-svg]: https://codeclimate.com/github/grokify/html-strip-tags-go/badges/gpa.svg
[codeclimate-status-link]: https://codeclimate.com/github/grokify/html-strip-tags-go
[docs-godoc-svg]: https://pkg.go.dev/badge/github.com/grokify/html-strip-tags-go
[docs-godoc-link]: https://pkg.go.dev/github.com/grokify/html-strip-tags-go
[license-svg]: https://img.shields.io/badge/license-BSD--style+patent--grant-blue.svg
[license-link]: https://github.com/grokify/html-strip-tags-go/blob/master/LICENSE