From bcd6dd8711ba8ea44cbfa17ea3c9b0ae0a4559e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytautas=20=C5=A0altenis?= Date: Thu, 10 Dec 2015 20:52:47 +0200 Subject: [PATCH] Don't require the input to end with a newline Technically, not ending a line with a newline is wrong, but this blunder is so pervasive that we have no other choice but to live with it. Fixes #180. --- inline_test.go | 3 +++ markdown.go | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inline_test.go b/inline_test.go index b608a0a..626db11 100644 --- a/inline_test.go +++ b/inline_test.go @@ -695,6 +695,9 @@ func TestReferenceLink(t *testing.T) { "[ref]\n [ref]: ../url/ \"title\"\n", "

ref

\n", + + "[link][ref]\n [ref]: /url/", + "

link

\n", } doLinkTestsInline(t, tests) } diff --git a/markdown.go b/markdown.go index ed6f794..f4a55a8 100644 --- a/markdown.go +++ b/markdown.go @@ -638,9 +638,6 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' { i++ } - if i == len(data) { - return - } linkEnd = i if data[linkOffset] == '<' && data[linkEnd-1] == '>' { linkOffset++