Correctly emit trailing header ID brace

This commit is contained in:
Dave Johnston 2014-04-05 20:59:03 +01:00
parent cf01a94556
commit 7ad5f9c119
2 changed files with 7 additions and 0 deletions

View File

@ -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] == '#' {

View File

@ -191,6 +191,12 @@ func TestPrefixHeaderIdExtension(t *testing.T) {
"# Header 1 {#someid\n",
"<h1>Header 1 {#someid</h1>\n",
"# Header 1 {#someid\n",
"<h1>Header 1 {#someid</h1>\n",
"# Header 1 {#someid}}\n",
"<h1 id=\"someid\">Header 1</h1>\n\n<p>}</p>\n",
"## Header 2 {#someid}\n",
"<h2 id=\"someid\">Header 2</h2>\n",