Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links with newline characters in the title text fail to render correctly #94

Closed
bhavin192 opened this issue Jan 26, 2020 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@bhavin192
Copy link

bhavin192 commented Jan 26, 2020

  1. What version of goldmark are you using? :
    Latest from master i.e. v1.1.21 or faaafa5
  2. What version of Go are you using? :
    go version go1.13.5 linux/amd64
  3. What operating system and processor architecture are you using? :
    Fedora 31 on amd64
  4. What did you do? :
package main

import (
	"fmt"
	"github.com/yuin/goldmark"
	"bytes"
)

func main() {
	source2 := `
[This link won't be rendered
correctly](https://geeksocket.in/some-long-link-here "This is the
place where everything breaks")
`

	var buf bytes.Buffer
	if err := goldmark.Convert([]byte(source2), &buf); err != nil {
		panic(err)
	}
	fmt.Println(buf.String())
}
  1. What did you expect to see? :
    The link should get rendered correctly with title attribute set.
  2. What did you see instead? :
    It get's rendered as
<p>[This link won't be rendered
correctly](https://geeksocket.in/some-long-link-here &quot;This is the
place where everything breaks&quot;)</p>
  1. Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?:
    Yes.

I tried going trough the source code and debug this issue, but I wasn't able to completely understand what all is happening in parseBlock function here https://github.com/yuin/goldmark/blob/master/parser/parser.go#L1106
For the link label it advances the next line segment correctly but for the title text it doesn't.
Would like to send a fix if anyone can help me to understand why it's failing.

@yuin yuin closed this as completed in 39db45a Jan 27, 2020
@yuin yuin added the bug Something isn't working label Jan 27, 2020
bhavin192 added a commit to bhavin192/hugo that referenced this issue Jan 28, 2020
v1.1.22 has a fix for issue where links with newline in the title
don't get parsed correctly. Reference:
yuin/goldmark#94

Signed-off-by: Bhavin Gandhi <[email protected]>
bep pushed a commit to gohugoio/hugo that referenced this issue Jan 29, 2020
v1.1.22 has a fix for issue where links with newline in the title
don't get parsed correctly. Reference:
yuin/goldmark#94

Signed-off-by: Bhavin Gandhi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants