Implement SkipImages and add test

This commit is contained in:
Vytautas Šaltenis 2016-04-05 11:12:30 +03:00
parent 9da90c5929
commit fecfec2059
2 changed files with 12 additions and 0 deletions

View File

@ -1170,6 +1170,9 @@ func (r *HTML) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus {
}
}
case Image:
if r.flags&SkipImages != 0 {
return SkipChildren
}
if entering {
dest := node.LinkData.Destination
dest = r.addAbsPrefix(dest)

View File

@ -1130,6 +1130,15 @@ func TestSkipLinks(t *testing.T) {
})
}
func TestSkipImages(t *testing.T) {
doTestsInlineParam(t, []string{
"![foo](/bar/)\n",
"<p></p>\n",
}, TestParams{
HTMLFlags: SkipImages,
})
}
func TestUseXHTML(t *testing.T) {
doTestsParam(t, []string{
"---",