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

Function handleHead

utils/html2md/html2markdown.go:295–313  ·  view source on GitHub ↗

[ok]handle tag h1~h6

(doc *goquery.Document)

Source from the content-addressed store, hash-verified

293
294//[ok]handle tag h1~h6
295func handleHead(doc *goquery.Document) *goquery.Document {
296 heads := map[string]string{
297 "title": "# ",
298 "h1": "# ",
299 "h2": "## ",
300 "h3": "### ",
301 "h4": "#### ",
302 "h5": "##### ",
303 "h6": "###### ",
304 }
305 for tag, replace := range heads {
306 doc.Find(tag).Each(func(i int, selection *goquery.Selection) {
307 text, _ := selection.Html()
308 selection.BeforeHtml("\n\r" + replace + text + "\n\r")
309 selection.Remove()
310 })
311 }
312 return doc
313}
314
315func handleTag2Tag(doc *goquery.Document) *goquery.Document {
316 for tag, toTag := range tag2tag {

Callers 1

ConvertFunction · 0.85

Calls 1

FindMethod · 0.45

Tested by

no test coverage detected