gh-markdown-cli icon indicating copy to clipboard operation
gh-markdown-cli copied to clipboard

mailto: links break the generated HTML

Open fiznool opened this issue 11 years ago • 4 comments

I am trying to do this:

$ echo "[Send email](mailto:[email protected])" | mdown

I am expecting this output:

<p><a href="mailto:[email protected]">Send email</a></p>

But instead I get this:

<p><a href="mailto:<a href='mailto:[email protected]'>[email protected]</a>">Send email</a></p>

I guess this might be a problem with the underlying parser? Or maybe this syntax isn't supported?

fiznool avatar Oct 22 '12 20:10 fiznool

It's an issue on the markdown parser.

If you do echo "[email protected]" | mdown it generates the "mailto" link <p><a href="mailto:[email protected]">[email protected]</a></p>.

Maybe we should change the parser, see #4.

millermedeiros avatar Oct 24 '12 03:10 millermedeiros

Yes, I can see the offending line: https://github.com/isaacs/github-flavored-markdown/blob/master/scripts/showdown.js#L193

Perhaps it would be easier to submit a patch to the markdown parser project to only add the anchor tag if the mailto is not already present, much in the same way that regular URL links are parsed: https://github.com/isaacs/github-flavored-markdown/blob/master/scripts/showdown.js#L188

fiznool avatar Oct 24 '12 08:10 fiznool

@fiznool based on the README on isaacs repository (that github abandoned the JS implementation) I guess we should change the markdown parser to one that follows GFM closer. I will leave this bug opened to remind we should replace the parser.

millermedeiros avatar Oct 24 '12 17:10 millermedeiros

Just stumbled over this again :wink:

Midnighter avatar Apr 25 '20 20:04 Midnighter