mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Fixes #94
This commit is contained in:
parent
faaafa55b6
commit
39db45a099
2 changed files with 37 additions and 7 deletions
|
|
@ -63,3 +63,16 @@ _**TL/DR** - [Go see summary.](#my-summary-area)_
|
|||
//- - - - - - - - -//
|
||||
<p><em><strong>TL/DR</strong> - <a href="#my-summary-area">Go see summary.</a></em></p>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
||||
|
||||
|
||||
6
|
||||
//- - - - - - - - -//
|
||||
[This link won't be rendered
|
||||
correctly](https://geeksocket.in/some-long-link-here "This is the
|
||||
place where everything breaks")
|
||||
//- - - - - - - - -//
|
||||
<p><a href="https://geeksocket.in/some-long-link-here" title="This is the
|
||||
place where everything breaks">This link won't be rendered
|
||||
correctly</a></p>
|
||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||
|
|
|
|||
|
|
@ -351,14 +351,31 @@ func parseLinkTitle(block text.Reader) ([]byte, bool) {
|
|||
if opener == '(' {
|
||||
closer = ')'
|
||||
}
|
||||
line, _ := block.PeekLine()
|
||||
pos := util.FindClosure(line[1:], opener, closer, false, true)
|
||||
if pos < 0 {
|
||||
return nil, false
|
||||
savedLine, savedPosition := block.Position()
|
||||
var title []byte
|
||||
for i := 0; ; i++ {
|
||||
line, _ := block.PeekLine()
|
||||
if line == nil {
|
||||
block.SetPosition(savedLine, savedPosition)
|
||||
return nil, false
|
||||
}
|
||||
offset := 0
|
||||
if i == 0 {
|
||||
offset = 1
|
||||
}
|
||||
pos := util.FindClosure(line[offset:], opener, closer, false, true)
|
||||
if pos < 0 {
|
||||
title = append(title, line[offset:]...)
|
||||
block.AdvanceLine()
|
||||
continue
|
||||
}
|
||||
pos += offset + 1 // 1: closer
|
||||
block.Advance(pos)
|
||||
if i == 0 { // avoid allocating new slice
|
||||
return line[offset : pos-1], true
|
||||
}
|
||||
return append(title, line[offset:pos-1]...), true
|
||||
}
|
||||
pos += 2 // opener + closer
|
||||
block.Advance(pos)
|
||||
return line[1 : pos-1], true
|
||||
}
|
||||
|
||||
func (s *linkParser) CloseBlock(parent ast.Node, block text.Reader, pc Context) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue