mirror of
https://github.com/danog/blackfriday.git
synced 2025-01-23 05:41:27 +01:00
Correctly emit trailing header ID brace
This commit is contained in:
parent
cf01a94556
commit
7ad5f9c119
1
block.go
1
block.go
@ -196,6 +196,7 @@ func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int {
|
|||||||
if j < end && k < end {
|
if j < end && k < end {
|
||||||
id = string(data[j+2:k])
|
id = string(data[j+2:k])
|
||||||
end = j
|
end = j
|
||||||
|
skip = k + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for end > 0 && data[end-1] == '#' {
|
for end > 0 && data[end-1] == '#' {
|
||||||
|
@ -191,6 +191,12 @@ func TestPrefixHeaderIdExtension(t *testing.T) {
|
|||||||
"# Header 1 {#someid\n",
|
"# Header 1 {#someid\n",
|
||||||
"<h1>Header 1 {#someid</h1>\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",
|
"## Header 2 {#someid}\n",
|
||||||
"<h2 id=\"someid\">Header 2</h2>\n",
|
"<h2 id=\"someid\">Header 2</h2>\n",
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user