mirror of
https://github.com/danog/blackfriday.git
synced 2025-01-23 05:41:27 +01:00
The single node renderer is a separate func now
A default HTML renderer for a single node is now easily accessible. Makes it easy to fall back to the default behavior when writing custom HTML renderers.
This commit is contained in:
parent
886a1405c0
commit
0382dab0c3
12
html.go
12
html.go
@ -1211,10 +1211,7 @@ func (r *Html) cr() {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Html) Render(ast *Node) []byte {
|
||||
//println("render_Blackfriday")
|
||||
//dump(ast)
|
||||
ForEachNode(ast, func(node *Node, entering bool) {
|
||||
func (r *Html) RenderNode(node *Node, entering bool) {
|
||||
attrs := []string{}
|
||||
switch node.Type {
|
||||
case Text:
|
||||
@ -1511,6 +1508,11 @@ func (r *Html) Render(ast *Node) []byte {
|
||||
default:
|
||||
panic("Unknown node type " + node.Type.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (r *Html) Render(ast *Node) []byte {
|
||||
//println("render_Blackfriday")
|
||||
//dump(ast)
|
||||
ForEachNode(ast, r.RenderNode)
|
||||
return r.renderBuffer.Bytes()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user