mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
Merge pull request #32 from bertzzie/master
Enable Parsing Inside a Link
This commit is contained in:
commit
472fe3a756
|
@ -180,8 +180,8 @@ const (
|
||||||
|
|
||||||
// '[': parse a link or an image or a footnote
|
// '[': parse a link or an image or a footnote
|
||||||
func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
||||||
// no links allowed inside other links
|
// no links allowed inside regular links, footnote, and deferred footnotes
|
||||||
if p.insideLink {
|
if p.insideLink && (data[offset-1] == '[' || data[offset+1] == '^') {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -390,6 +390,9 @@ func TestInlineLink(t *testing.T) {
|
||||||
"[link]( with whitespace )\n",
|
"[link]( with whitespace )\n",
|
||||||
"<p><a href=\"with whitespace\">link</a></p>\n",
|
"<p><a href=\"with whitespace\">link</a></p>\n",
|
||||||
|
|
||||||
|
"[![image](someimage)](with image)\n",
|
||||||
|
"<p><a href=\"with image\"><img src=\"someimage\" alt=\"image\" />\n</a></p>\n",
|
||||||
|
|
||||||
"[link](url \"one quote)\n",
|
"[link](url \"one quote)\n",
|
||||||
"<p><a href=\"url "one quote\">link</a></p>\n",
|
"<p><a href=\"url "one quote\">link</a></p>\n",
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user