github.com/keysonZZZ/kmg@v0.0.0-20151121023212-05317bfd7d39/kmgHTMLPurifier/kmgHTMLPurifier.go (about) 1 package kmgHTMLPurifier 2 3 import ( 4 "github.com/microcosm-cc/bluemonday" 5 ) 6 7 // 去掉html属性 8 func HTMLPurifier(htmlInput string) string { 9 p := bluemonday.UGCPolicy() 10 html := p.Sanitize(htmlInput) 11 return html 12 } 13 14 // 去掉所有html 15 func HTMLPurifierAll(htmlInput string) string { 16 p := bluemonday.NewPolicy() 17 html := p.Sanitize(htmlInput) 18 return html 19 }