mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
#248 - 7
This commit is contained in:
parent
beafde4b8f
commit
05d89a0b45
2 changed files with 14 additions and 6 deletions
|
|
@ -542,7 +542,6 @@ _a[b_c_](d)
|
||||||
<p>[o] :x</p>
|
<p>[o] :x</p>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
|
|
||||||
42: Unclosed link reference titles can interrupt link references
|
42: Unclosed link reference titles can interrupt link references
|
||||||
//- - - - - - - - -//
|
//- - - - - - - - -//
|
||||||
[r]:
|
[r]:
|
||||||
|
|
@ -556,3 +555,10 @@ x
|
||||||
<p>'</p>
|
<p>'</p>
|
||||||
<p>'</p>
|
<p>'</p>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
|
43: A link containing an image containing a link should disable the outer link
|
||||||
|
//- - - - - - - - -//
|
||||||
|
[  ](x) ](y)
|
||||||
|
//- - - - - - - - -//
|
||||||
|
<p>[ <img src="x" alt=" b " /> ](y)</p>
|
||||||
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N
|
||||||
}
|
}
|
||||||
block.Advance(1)
|
block.Advance(1)
|
||||||
removeLinkLabelState(pc, last)
|
removeLinkLabelState(pc, last)
|
||||||
if s.containsLink(last) { // a link in a link text is not allowed
|
if !last.IsImage && s.containsLink(last) { // a link in a link text is not allowed
|
||||||
ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment)
|
ast.MergeOrReplaceTextSegment(last.Parent(), last, last.Segment)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -182,15 +182,17 @@ func (s *linkParser) Parse(parent ast.Node, block text.Reader, pc Context) ast.N
|
||||||
return link
|
return link
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *linkParser) containsLink(last *linkLabelState) bool {
|
func (s *linkParser) containsLink(n ast.Node) bool {
|
||||||
if last.IsImage {
|
if n == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
var c ast.Node
|
for c := n; c != nil; c = c.NextSibling() {
|
||||||
for c = last; c != nil; c = c.NextSibling() {
|
|
||||||
if _, ok := c.(*ast.Link); ok {
|
if _, ok := c.(*ast.Link); ok {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if s.containsLink(c.FirstChild()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue