1 // Package errs provides utilities for working with errors during JSON data unmarshalling.
2 // It includes functions for unescaping HTML content and checking if a string contains HTML or XML data.
3 package errs
4 5 import (
6 "strings"
7 8 "golang.org/x/net/html"
9 )
10 11 // UnescapeContent unescapes HTML content.
12 func UnescapeContent(content string) string {
13 //check if the content is HTML or XML
14 if isHTML(content) {
15 return html.UnescapeString(content)
16 }
17 return content
18 }
19 20 func isHTML(data string) bool {
21 _, err := html.Parse(strings.NewReader(data))
22 return err == nil
23 }
24