From fecfec2059f4488cbe431b57be0bdca6b3c63e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Tue, 5 Apr 2016 11:12:30 +0300 Subject: [PATCH] Implement SkipImages and add test --- html.go | 3 +++ inline_test.go | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/html.go b/html.go index 10d6159..260033e 100644 --- a/html.go +++ b/html.go @@ -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) diff --git a/inline_test.go b/inline_test.go index 76b2afb..28ff283 100644 --- a/inline_test.go +++ b/inline_test.go @@ -1130,6 +1130,15 @@ func TestSkipLinks(t *testing.T) { }) } +func TestSkipImages(t *testing.T) { + doTestsInlineParam(t, []string{ + "![foo](/bar/)\n", + "

\n", + }, TestParams{ + HTMLFlags: SkipImages, + }) +} + func TestUseXHTML(t *testing.T) { doTestsParam(t, []string{ "---",