From da8f2753e27c7fd79265c7420b7e2b9b94aa3dd5 Mon Sep 17 00:00:00 2001 From: Alex Xandra Albert Sim Date: Mon, 9 Sep 2013 12:51:20 +0700 Subject: [PATCH 1/2] Added test for link inside image --- inline_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inline_test.go b/inline_test.go index 60f764c..f7bc336 100644 --- a/inline_test.go +++ b/inline_test.go @@ -390,6 +390,9 @@ func TestInlineLink(t *testing.T) { "[link]( with whitespace )\n", "

link

\n", + "[![image](someimage)](with image)\n", + "

\"image\"\n

\n", + "[link](url \"one quote)\n", "

link

\n", From e2503482791441fc61805a4eab86cc3bc6b87f0c Mon Sep 17 00:00:00 2001 From: Alex Xandra Albert Sim Date: Mon, 9 Sep 2013 12:51:46 +0700 Subject: [PATCH 2/2] Image inside a link now works. --- inline.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inline.go b/inline.go index db02091..455f8fe 100644 --- a/inline.go +++ b/inline.go @@ -180,8 +180,8 @@ const ( // '[': parse a link or an image or a footnote func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { - // no links allowed inside other links - if p.insideLink { + // no links allowed inside regular links, footnote, and deferred footnotes + if p.insideLink && (data[offset-1] == '[' || data[offset+1] == '^') { return 0 }