You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x www.example.com[www.example.com![www.example.com[^ www.example.com[]www.example.com---
x https://example.com[https://example.com![https://example.com[^ https://example.com[]https://example.com---
x contact@example.com[contact@example.com![contact@example.com[^ contact@example.com[]contact@example.com
The reason for this is that, for performance reasons, GH has two algorithms to parse its autolink extension: www. and https?:// are handled when parsing, emails are handled when postprocessing.
One solution
One solution for this problem, is to perform everything when postprocessing (just like the new mailto and xmpp protocols).
However, postprocessing has problems: it does not consider character escapes or character references:
Problem
Consider:
This is currently rendered as:
x www.example.com
[ www.example.com
![ www.example.com
[^ www.example.com
[] www.example.com
x https://example.com
[ https://example.com
![ https://example.com
[^ https://example.com
[] https://example.com
x contact@example.com
[ contact@example.com
![ contact@example.com
[^ contact@example.com
[] contact@example.com
The reason for this is that, for performance reasons, GH has two algorithms to parse its autolink extension:
www.
andhttps?://
are handled when parsing, emails are handled when postprocessing.One solution
One solution for this problem, is to perform everything when postprocessing (just like the new mailto and xmpp protocols).
However, postprocessing has problems: it does not consider character escapes or character references:
Yields:
contact@example.com
contact@example.com
contact@example.com
These are examples of someone trying to prevent an email from being linked, using methods that work in the rest of markdown, but GFM ignores that.
A similar problem exists for math on GitHub, which some users are unhappy about, and results in weird and unintuitive ways to escape it.
A better solution
I think it should be possible to either:
CMARK_NODE_LINK
inextensions/autolink.c
CMARK_NODE_LINK
, to differentiate extension links from “normal” linksThen, update the extension to not exit when in a bracket.
Finally, when compiling, to output just the URL (not in a link) of an extension autolink, when already inside a link.
This solution, does come with an additional problem, but that can be mitigated.
Because URL parsing is so loose, it matches
](xxx)
. For example:Yields:
a www.example.com](www.example.org) b
a www.example.com b
It can be mitigated by, when seeing
]
, stopping if the next character is(
(or[
)The text was updated successfully, but these errors were encountered: