Copy post parsing funcs to posts pkg
This commit is contained in:
@@ -3,6 +3,7 @@ package posts
|
||||
import (
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
"github.com/writeas/saturday"
|
||||
"html"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode"
|
||||
@@ -61,3 +62,9 @@ func ApplyBasicMarkdown(data []byte) string {
|
||||
|
||||
return outHTML
|
||||
}
|
||||
|
||||
// StripHTMLWithoutEscaping strips HTML tags with bluemonday's StrictPolicy, then unescapes the HTML
|
||||
// entities added in by sanitizing the content.
|
||||
func StripHTMLWithoutEscaping(content string) string {
|
||||
return html.UnescapeString(bluemonday.StrictPolicy().Sanitize(content))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user