mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-04 07:57:19 -04:00
Traverse through parents to detect ignored AST children
This commit is contained in:
+7
-9
@@ -129,17 +129,15 @@ func (r *ANSIRenderer) renderNode(w util.BufWriter, source []byte, node ast.Node
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isChild(node ast.Node) bool {
|
func isChild(node ast.Node) bool {
|
||||||
if node.Parent() == nil {
|
for n := node.Parent(); n != nil; n = n.Parent() {
|
||||||
return false
|
// These types are already rendered by their parent
|
||||||
|
switch n.Kind() {
|
||||||
|
case ast.KindLink, ast.KindImage, ast.KindEmphasis, astext.KindStrikethrough, ast.KindBlockquote, astext.KindTableCell:
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// These types are already rendered by their parent
|
return false
|
||||||
switch node.Parent().Kind() {
|
|
||||||
case ast.KindLink, ast.KindImage, ast.KindEmphasis, astext.KindStrikethrough, ast.KindBlockquote, astext.KindTableCell:
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveRelativeURL(baseURL string, rel string) string {
|
func resolveRelativeURL(baseURL string, rel string) string {
|
||||||
|
|||||||
Reference in New Issue
Block a user