From 7ad5f9c1197c54c0be24fb0b0b1d75eb7ef19d89 Mon Sep 17 00:00:00 2001 From: Dave Johnston Date: Sat, 5 Apr 2014 20:59:03 +0100 Subject: [PATCH] Correctly emit trailing header ID brace --- block.go | 1 + block_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/block.go b/block.go index e73cf02..2069163 100644 --- a/block.go +++ b/block.go @@ -196,6 +196,7 @@ func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int { if j < end && k < end { id = string(data[j+2:k]) end = j + skip = k + 1 } } for end > 0 && data[end-1] == '#' { diff --git a/block_test.go b/block_test.go index 20f29a1..fc03836 100644 --- a/block_test.go +++ b/block_test.go @@ -191,6 +191,12 @@ func TestPrefixHeaderIdExtension(t *testing.T) { "# Header 1 {#someid\n", "

Header 1 {#someid

\n", + "# Header 1 {#someid\n", + "

Header 1 {#someid

\n", + + "# Header 1 {#someid}}\n", + "

Header 1

\n\n

}

\n", + "## Header 2 {#someid}\n", "

Header 2

\n",