// example based on https://arslexis.io/goplayground/#2yV5-HDKBUV
func modifyAst(doc ast.Node) ast.Node {
ast.WalkFunc(doc, func(node ast.Node, entering bool) ast.WalkStatus {
if link, ok := node.(*ast.Link); ok && entering {
if link.Attribute == nil {
link.Attribute = &ast.Attribute{}
}
link.Attribute.Classes = append(link.Attribute.Classes, []byte("underline"))
}
return ast.GoToNext
})
return doc
}