goldmark icon indicating copy to clipboard operation
goldmark copied to clipboard

Bad href attribute when linkify and typographer extensions are enabled

Open jmooring opened this issue 2 years ago • 6 comments

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>&ldquo;<a href="https://example.org/">https://example.org/</a>&rdquo;</p>

Actual output:

<p>&ldquo;<a href="https://example.org/%22">https://example.org/&quot;</a></p>

The behavior is triggered by the trailing slash in the URL.

jmooring avatar Nov 03 '22 08:11 jmooring

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.

stale[bot] avatar Jan 07 '23 19:01 stale[bot]

Keep, pending response to https://github.com/github/cmark-gfm/issues/297.

jmooring avatar Jan 07 '23 19:01 jmooring

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 29 '23 09:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 12 '23 09:06 github-actions[bot]

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.

jmooring avatar Jan 26 '24 15:01 jmooring

Ping

mwat56 avatar Mar 15 '24 18:03 mwat56