goldmark
goldmark copied to clipboard
Bad href attribute when linkify and typographer extensions are enabled
What version of goldmark are you using? : 1.5.2 What version of Go are you using? : 1.19.3 What operating system and processor architecture are you using? : linux/amd64
code
package main
import (
"bytes"
"fmt"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
)
func main() {
md := goldmark.New(
goldmark.WithExtensions(
extension.Typographer,
extension.Linkify,
),
)
input := `"https://example.org/"`
var buf bytes.Buffer
if err := md.Convert([]byte(input), &buf); err != nil {
panic(err)
}
fmt.Println(buf.String())
}
Expected output:
<p>“<a href="https://example.org/">https://example.org/</a>”</p>
Actual output:
<p>“<a href="https://example.org/%22">https://example.org/"</a></p>
The behavior is triggered by the trailing slash in the URL.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Keep, pending response to https://github.com/github/cmark-gfm/issues/297.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
At this point it is unlikely that anyone will respond to https://github.com/github/cmark-gfm/issues/297#issue-1474072798.
I would either mirror the reference implementation (which will provide GFM compatibility) or close this issue. I'm fine either way.
Ping