MCPcopy
hub / github.com/larksuite/cli / renderFragment

Function renderFragment

shortcuts/mail/lint/linter.go:471–477  ·  view source on GitHub ↗

renderFragment serialises a fragment-rooted html tree to a string. We use the html package's Render which always emits the document-style markup; for fragment input we strip the implicit ... wrapper that html.Parse adds.

(root *xhtml.Node)

Source from the content-addressed store, hash-verified

469// for fragment input we strip the implicit <html><head></head><body>...</body></html>
470// wrapper that html.Parse adds.
471func renderFragment(root *xhtml.Node) string {
472 var buf bytes.Buffer
473 for child := root.FirstChild; child != nil; child = child.NextSibling {
474 _ = xhtml.Render(&buf, child)
475 }
476 return buf.String()
477}
478
479// applyFeishuNativeStyles walks the tree (post-tag-pass) and ensures elements
480// that have known Feishu mail-editor native inline styles get them autofilled.

Callers 1

RunFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected