This commit is contained in:
Liang Ding 2023-01-19 20:51:32 +08:00
parent 30a5cdc9f5
commit 1e2a707e02
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 26 additions and 6 deletions

View file

@ -118,6 +118,25 @@ func renderBlockDOMByNodes(nodes []*ast.Node, luteEngine *lute.Lute) string {
return h
}
func renderBlockContentByNodes(nodes []*ast.Node) string {
var subNodes []*ast.Node
for _, n := range nodes {
if ast.NodeDocument == n.Type {
for c := n.FirstChild; nil != c; c = c.Next {
subNodes = append(subNodes, c)
}
} else {
subNodes = append(subNodes, n)
}
}
buf := bytes.Buffer{}
for _, n := range subNodes {
buf.WriteString(treenode.NodeStaticContent(n, nil))
}
return buf.String()
}
func renderBlockMarkdownR(id string) string {
var rendered []string
nodes := renderBlockMarkdownR0(id, &rendered)