[markdown] raw links are wrongly and insonsistently parsed and rendered
- creates empty link before actual link (
<a href="https://url.only.link"></a>
) - closing non-letter-symbols in raw links are getting ignored
- links inside code-blocks are being parsed (inconsistently)
- double-quotes and angle-brackets inside links lead to html-splitting, and showing text different from the link
i assume earmark
is the source of this problem since all *-fe have the same output
text used for the test:
https://url.only.link
https://url.with.cloding.slash.link/
https://www.1.link/folder_only
https://1.link/slash_after_folder/
https://www.2.link/folder_only_with_extra_underscore_
https://2.link/slash_after_folder_with_extra_underscore_/
https://www.3.link/folder_only--(with+round+brackets)
https://3.link/slash_after_folder--(with+round+brackets)/
https://www.4.link/folder_only--[with+square+brackets]
https://4.link/slash_after_folder--[with+square+brackets]/
https://www.5.link/folder_only--{with+curly+brackets}
https://5.link/slash_after_folder--{with+curly+brackets}/
https://www.6.link/folder_only--<with+angle+brackets>
https://6.link/slash_after_folder--<with+angle+brackets>/
https://www.7.link/folder_only--one+single+quote+at+the+end'
https://7.link/slash_after_folder--one+single+quote+at+the+end'/
https://www.8.link/folder_only--'single+quoted+part'
https://8.link/slash_after_folder--'single+quoted+part'/
https://www.9.link/folder_only--one+double+quote+at+the+end"
https://9.link/slash_after_folder--one+double+quote+at+the+end"/
https://www.10.link/folder_only--"double+quoted+part"
https://10.link/slash_after_folder--"double+quoted+part"/
output rendered html:
<p>this is a regular text:</p>
<p>
<a href="https://url.only.link"></a>
<a href="https://url.only.link" rel="ugc">url.only.link</a>
<a href="https://url.with.cloding.slash.link"></a>
<a href="https://url.with.cloding.slash.link" rel="ugc">url.with.cloding.slash.link</a>/</p>
<p>
<a href="https://www.1.link/folder_only"></a>
<a href="https://www.1.link/folder_only" rel="ugc">1.link/folder_only</a>
<a href="https://1.link/slash_after_folder"></a>
<a href="https://1.link/slash_after_folder" rel="ugc">1.link/slash_after_folder</a>/</p>
<p>
<a href="https://www.2.link/folder_only_with_extra_underscore_"></a>
<a href="https://www.2.link/folder_only_with_extra_underscore_" rel="ugc">2.link/folder_only_with_extra_underscore_</a>
<a href="https://2.link/slash_after_folder_with_extra_underscore_"></a>
<a href="https://2.link/slash_after_folder_with_extra_underscore_" rel="ugc">2.link/slash_after_folder_with_extra_underscore_</a>/</p>
<p>
<a href="https://www.3.link/folder_only--(with+round+brackets"></a>
<a href="https://www.3.link/folder_only--(with+round+brackets" rel="ugc">3.link/folder_only--(with+round+brackets</a>)
<a href="https://3.link/slash_after_folder--(with+round+brackets"></a>
<a href="https://3.link/slash_after_folder--(with+round+brackets" rel="ugc">3.link/slash_after_folder--(with+round+brackets</a>)/</p>
<p>
<a href="https://www.4.link/folder_only--[with+square+brackets"></a>
<a href="https://www.4.link/folder_only--[with+square+brackets" rel="ugc">4.link/folder_only--[with+square+brackets</a>]
<a href="https://4.link/slash_after_folder--[with+square+brackets"></a>
<a href="https://4.link/slash_after_folder--[with+square+brackets" rel="ugc">4.link/slash_after_folder--[with+square+brackets</a>]/</p>
<p>
<a href="https://www.5.link/folder_only--{with+curly+brackets">https://www.5.link/folder_only--{with+curly+brackets</a>}
<a href="https://5.link/slash_after_folder--{with+curly+brackets">https://5.link/slash_after_folder--{with+curly+brackets</a>}/</p>
<p>
<a href="https://www.6.link/folder_only--<with+angle+brackets">https://www.6.link/folder_only-->
</a>
<a href="https://6.link/slash_after_folder--<with+angle+brackets">https://6.link/slash_after_folder-->/</a></p>
<p>
<a href="https://www.7.link/folder_only--one+single+quote+at+the+end"></a>
<a href="https://www.7.link/folder_only--one+single+quote+at+the+end" rel="ugc">7.link/folder_only--one+single+quote+at+the+end</a>’
<a href="https://7.link/slash_after_folder--one+single+quote+at+the+end"></a>
<a href="https://7.link/slash_after_folder--one+single+quote+at+the+end" rel="ugc">7.link/slash_after_folder--one+single+quote+at+the+end</a>’/</p>
<p>
<a href="https://www.8.link/folder_only--'single+quoted+part"></a>
<a href="https://www.8.link/folder_only--'single+quoted+part" rel="ugc">8.link/folder_only--'single+quoted+part</a>’
<a href="https://8.link/slash_after_folder--'single+quoted+part"></a>
<a href="https://8.link/slash_after_folder--'single+quoted+part" rel="ugc">8.link/slash_after_folder--'single+quoted+part</a>’/</p>
<p>
<a href="https://www.9.link/folder_only--one+double+quote+at+the+end"></a>
<a href="https://www.9.link/folder_only--one+double+quote+at+the+end" rel="ugc">9.link/folder_only--one+double+quote+at+the+end</a>”
<a href="https://9.link/slash_after_folder--one+double+quote+at+the+end"></a>
<a href="https://9.link/slash_after_folder--one+double+quote+at+the+end" rel="ugc">9.link/slash_after_folder--one+double+quote+at+the+end</a>”/</p>
<p>
<a href="https://www.10.link/folder_only--">https://www.10.link/folder_only--"double+quoted+part</a>”
<a href="https://10.link/slash_after_folder--">https://10.link/slash_after_folder--"double+quoted+part</a>”/
</p>
<p>it’s a code block, where links should not be parsed at all:</p>
<pre><code><a href="https://url.only.link" rel="ugc">url.only.link</a>
<a href="https://url.with.cloding.slash.link/" rel="ugc">url.with.cloding.slash.link/</a>
<a href="https://www.1.link/folder_only" rel="ugc">1.link/folder_only</a>
<a href="https://1.link/slash_after_folder/" rel="ugc">1.link/slash_after_folder/</a>
<a href="https://www.2.link/folder_only_with_extra_underscore_" rel="ugc">2.link/folder_only_with_extra_underscore_</a>
<a href="https://2.link/slash_after_folder_with_extra_underscore_/" rel="ugc">2.link/slash_after_folder_with_extra_underscore_/</a>
<a href="https://www.3.link/folder_only--(with+round+brackets)" rel="ugc">3.link/folder_only--(with+round+brackets)</a>
<a href="https://3.link/slash_after_folder--(with+round+brackets)/" rel="ugc">3.link/slash_after_folder--(with+round+brackets)/</a>
<a href="https://www.4.link/folder_only--[with+square+brackets]" rel="ugc">4.link/folder_only--[with+square+brackets]</a>
<a href="https://4.link/slash_after_folder--[with+square+brackets]/" rel="ugc">4.link/slash_after_folder--[with+square+brackets]/</a>
https://www.5.link/folder_only--{with+curly+brackets}
https://5.link/slash_after_folder--{with+curly+brackets}/
<a href="https://www.6.link/folder_only--<with+angle+brackets>" rel="ugc">6.link/folder_only--<with+angle+brackets></a>
<a href="https://6.link/slash_after_folder--<with+angle+brackets>/" rel="ugc">6.link/slash_after_folder--<with+angle+brackets>/</a>
<a href="https://www.7.link/folder_only--one+single+quote+at+the+end'" rel="ugc">7.link/folder_only--one+single+quote+at+the+end'</a>
<a href="https://7.link/slash_after_folder--one+single+quote+at+the+end'/" rel="ugc">7.link/slash_after_folder--one+single+quote+at+the+end'/</a>
<a href="https://www.8.link/folder_only--'single+quoted+part'" rel="ugc">8.link/folder_only--'single+quoted+part'</a>
<a href="https://8.link/slash_after_folder--'single+quoted+part'/" rel="ugc">8.link/slash_after_folder--'single+quoted+part'/</a>
<a href="https://www.9.link/folder_only--one+double+quote+at+the+end"" rel="ugc">9.link/folder_only--one+double+quote+at+the+end"</a>
<a href="https://9.link/slash_after_folder--one+double+quote+at+the+end"/" rel="ugc">9.link/slash_after_folder--one+double+quote+at+the+end"/</a>
<a href="https://www.10.link/folder_only--"double+quoted+part"" rel="ugc">10.link/folder_only--"double+quoted+part"</a>
<a href="https://10.link/slash_after_folder--"double+quoted+part"/" rel="ugc">10.link/slash_after_folder--"double+quoted+part"/</a>
</code>
</pre>
visual for text:
visual for code ("pre") block:
special case with angle-brackets:
special case with double-quotes
(same happens with proper links btw, [link](https://some.wiki/Some_"Quoted Part")
):
live example (stable branch): https://dym.sh/notice/9xo4i2wycHhOrrc9ei
Edited by Ghost User