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

Handle Parenthesis in links properly #98

Closed
ghost opened this issue Oct 27, 2019 · 2 comments
Closed

Handle Parenthesis in links properly #98

ghost opened this issue Oct 27, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 27, 2019

Using this file:

$ cat input.md
https://en.wikipedia.org/wiki/The_Master_(2012_film)

I get this result:

$ mmark -html input.md
<!DOCTYPE html>
<html>
<!-- ... -->
<body>
<p><a href="https://en.wikipedia.org/wiki/The_Master_(2012_film"
>https://en.wikipedia.org/wiki/The_Master_(2012_film</a>)</p>
</body>
</html>

Note that the final parenthesis is not included as part of the link. Other
processors work as expected. For example GitHub parser:

https://en.wikipedia.org/wiki/The_Master_(2012_film)

@ghost
Copy link
Author

ghost commented Oct 28, 2019

Here is a workaround:

package main
import (
   "bytes"
   "github.com/yuin/goldmark"
   "github.com/yuin/goldmark/extension"
)
func main() {
   s1 := "https://en.wikipedia.org/wiki/The_Master_(2012_film)"
   o1 := goldmark.New(goldmark.WithExtensions(extension.Linkify))
   var b2 bytes.Buffer
   o1.Convert([]byte(s1), &b2)
   s2 := b2.String()
   print(s2)
}

https://github.com/yuin/goldmark

@miekg
Copy link
Contributor

miekg commented Dec 31, 2019

Enclose the link with < and >

@miekg miekg closed this as completed Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant