all repos — grayfriday @ 8ad7215b24aa5f4ebe22d6995ebf476e3a4a2797

blackfriday fork with a few changes

Merge pull request #138 from KenjiTakahashi/emphasis_link

Fix for #19 + some tests for emphasis with links.
Vytautas Ĺ altenis vytas@rtfb.lt
Mon, 29 Dec 2014 02:32:11 +0200
commit

8ad7215b24aa5f4ebe22d6995ebf476e3a4a2797

parent

48aaef5fbf8eb2337daca96fcc89f973981b9137

2 files changed, 18 insertions(+), 1 deletions(-)

jump to
M inline.goinline.go

@@ -948,7 +948,7 @@ cc := data[i]

i++ for i < len(data) && data[i] != cc { if tmpI == 0 && data[i] == c { - tmpI = i + return i } i++ }
M inline_test.goinline_test.go

@@ -239,6 +239,23 @@ }

doTestsInline(t, tests) } +func TestEmphasisLink(t *testing.T) { + var tests = []string{ + "[first](before) *text[second] (inside)text* [third](after)\n", + "<p><a href=\"before\">first</a> <em>text<a href=\"inside\">second</a>text</em> <a href=\"after\">third</a></p>\n", + + "*incomplete [link] definition*\n", + "<p><em>incomplete [link] definition</em></p>\n", + + "*it's [emphasis*] (not link)\n", + "<p><em>it's [emphasis</em>] (not link)</p>\n", + + "*it's [emphasis*] and *[asterisk]\n", + "<p><em>it's [emphasis</em>] and *[asterisk]</p>\n", + } + doTestsInline(t, tests) +} + func TestStrikeThrough(t *testing.T) { var tests = []string{ "nothing inline\n",