Describe the feature
Automatic translate ipv6 urls to links
Problem
> marked("IPv4 url: http://127.0.0.1/index.html\n IPv6 url: http://[1080:0:0:0:8:800:200C:417A]/index.html")
< "<p>IPv4 url: <a href="http://127.0.0.1/index.html">http://127.0.0.1/index.html</a>
IPv6 url: http://[1080:0:0:0:8:800:200C:417A]/index.html</p>
"
Related rfc: https://tools.ietf.org/html/rfc2732
IPv4 url: http://127.0.0.1/index.html
IPv6 url: http://[1080:0:0:0:8:800:200C:417A]/index.html
It doesn't look like GFM autolinks IPv6 urls. If you want it to become part of the GFM spec you can create an issue here.
A work around is to surround it in angle brackets (<>):
<http://[1080:0:0:0:8:800:200C:417A]/index.html>
IPv4 url: http://127.0.0.1/index.html
IPv6 url: http://[1080:0:0:0:8:800:200C:417A]/index.htmlIt doesn't look like GFM autolinks IPv6 urls. If you want it to become part of the GFM spec you can create an issue here.
A work around is to surround it in angle brackets (
<>):<http://[1080:0:0:0:8:800:200C:417A]/index.html>
Angle brackets didn't work.
I get the same error as here:
Looks like they are using an old version of marked. The latest version does work with angle brackets. demo
Looks like they are using an old version of marked. The latest version does work with angle brackets. demo
^I keep getting this, clicking the links in Chrome. Firefox just ignores link clicks, doing nothing in response instead of showing the error, so both browsers are affected.
Note that another ZeroNet site by @HelloZeroNet doesn't have this problem. It lets you proceed to the site, so then both browsers are fine in this case.
There is nothing marked can do about that you will have to create an issue with chrome and firefox.
A quick google search finds this support thread. Hope that helps.
You sure it's not the site?
It seems like it is the browser blocking that link from that site for security reasons. It could be a change to the site that fixes it (maybe it has mixed content or invalid certificates), but I know that changing marked will not help it in any way.
Looks like they are using an old version of marked. The latest version does work with angle brackets. demo
The example also results in "about:blank#blocked", because the [ and ] in the generated html href got url encoded:
<p><a href="http://%5B1080:0:0:0:8:800:200C:417A%5D/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></p>
The example also results in "about:blank#blocked", because the [ and ] in the generated html href got url encoded
That is also according to the spec.
If you want to change that behavior in marked you can create a renderer.
The following proof of concept code has not been tested and most likely will need to be changed to cover edge cases and fix any bugs.
const renderer = {
link(href, title, text) {
href = href.replace(/^(https?:\/\/)%5B(.*?)%5D/, '$1[$2]');
return marked.Renderer.prototype.link(href, title, text);
};
marked.use({ renderer });
console.log(marked('<http://[1080:0:0:0:8:800:200C:417A]/index.html>'));
Most helpful comment
The example also results in "about:blank#blocked", because the [ and ] in the generated html href got url encoded:
Test: http://[1080:0:0:0:8:800:200C:417A]/index.html