MCPcopy Index your code
hub / github.com/TruthHun/BookStack / trimAttr

Function trimAttr

utils/html2md/html2markdown.go:96–115  ·  view source on GitHub ↗

trip attr

(doc *goquery.Document)

Source from the content-addressed store, hash-verified

94
95// trip attr
96func trimAttr(doc *goquery.Document) *goquery.Document {
97 attrs := []string{
98 "border", "colspan", "rowspan", "style", "cellspacing",
99 "cellpadding", "bgcolor", "width", "align", "frame", "id", "class",
100 }
101 elements := []string{
102 "table", "thead", "tbody", "tr", "td", "th", "h1", "h2", "h3", "h4", "img",
103 "h5", "h6", "i", "em", "strong", "span", "br", "hr", "ul", "li", "ol",
104 }
105 elements = append(elements, blockTag...)
106 elements = append(elements, nextlineTag...)
107 for _, tag := range elements {
108 doc.Find(tag).Each(func(i int, selection *goquery.Selection) {
109 for _, attr := range attrs {
110 selection.RemoveAttr(attr)
111 }
112 })
113 }
114 return doc
115}
116
117//压缩html
118func compress(doc *goquery.Document) (*goquery.Document, map[string]string) {

Callers 2

ConvertFunction · 0.85
depressFunction · 0.85

Calls 2

appendFunction · 0.50
FindMethod · 0.45

Tested by

no test coverage detected