Hash :
ef5f230f
Author :
Date :
2016-10-14T19:56:05
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
# Permissive URL Autolinks
With the flag `MD_FLAG_PERMISSIVEURLAUTOLINKS`, MD4C enables more permissive recognition
of URLs and transform them to autolinks, even if they do not exactly follow the syntax
of autolink as specified in CommonMark specification.
This is standard CommonMark autolink:
```````````````````````````````` example
Homepage: <https://github.com/mity/md4c>
.
<p>Homepage: <a href="https://github.com/mity/md4c">https://github.com/mity/md4c</a></p>
````````````````````````````````
With the permissive autolinks enabled, this is sufficient:
```````````````````````````````` example
Homepage: https://github.com/mity/md4c
.
<p>Homepage: <a href="https://github.com/mity/md4c">https://github.com/mity/md4c</a></p>
````````````````````````````````
But this permissive autolink feature can work only for very widely used URL
schemes, in alphabetical order `ftp:`, `http:`, `https:` and `mailto:`,
so this is not an permissive autolink.
That's why this is not a permissive autolink:
```````````````````````````````` example
ssh://root@example.com
.
<p>ssh://root@example.com</p>
````````````````````````````````
As certain characters (`.`, `?`, `=`, `&`, `%`, `+`, `-`, `_`, `#`, `@`) can collide
with a normal text flow, they are not recognized as part of the URL unless another
alphanumeric character immediately follows.
Therefore the question mark in this question is not part of the autolink's
contents:
```````````````````````````````` example
Have you ever visited http://www.zombo.com?
.
<p>Have you ever visited <a href="http://www.zombo.com">http://www.zombo.com</a>?</p>
````````````````````````````````
But in contrast, in this example it is:
```````````````````````````````` example
http://www.bing.com/search?q=md4c
.
<p><a href="http://www.bing.com/search?q=md4c">http://www.bing.com/search?q=md4c</a></p>
````````````````````````````````
Please note that e-mail addresses without the `mailto:` scheme are not permissive URL
autolinks, but MD4C implements another extension `MD_FLAG_PERMISSIVEEMAILAUTOLINKS`
which can be used to enable that too.
```````````````````````````````` example
mailto:john.doe@example.com
.
<p><a href="mailto:john.doe@example.com">mailto:john.doe@example.com</a></p>
````````````````````````````````
```````````````````````````````` example
john.doe@example.com
.
<p>john.doe@example.com</p>
````````````````````````````````