diff --git a/inline.go b/inline.go index 651e4e8..f76d7b3 100644 --- a/inline.go +++ b/inline.go @@ -948,7 +948,7 @@ func helperFindEmphChar(data []byte, c byte) int { i++ for i < len(data) && data[i] != cc { if tmpI == 0 && data[i] == c { - tmpI = i + return i } i++ } diff --git a/inline_test.go b/inline_test.go index 7ad3f0d..e95eb97 100644 --- a/inline_test.go +++ b/inline_test.go @@ -239,6 +239,23 @@ func TestEmphasisMix(t *testing.T) { doTestsInline(t, tests) } +func TestEmphasisLink(t *testing.T) { + var tests = []string{ + "[first](before) *text[second] (inside)text* [third](after)\n", + "
\n", + + "*incomplete [link] definition*\n", + "incomplete [link] definition
\n", + + "*it's [emphasis*] (not link)\n", + "it's [emphasis] (not link)
\n", + + "*it's [emphasis*] and *[asterisk]\n", + "it's [emphasis] and *[asterisk]
\n", + } + doTestsInline(t, tests) +} + func TestStrikeThrough(t *testing.T) { var tests = []string{ "nothing inline\n",