1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Better autolinks

This doesn't follow gfm spec yet, work lifted from my code over
at
8505e2737e/src/Parsers/GitHubFlavor/Inlines/AutoLink.php

Fixes #505
Fixes #717
This commit is contained in:
Aidan Woods
2021-10-11 20:09:57 +01:00
parent cc5614bc5c
commit 7d1b9ca562
3 changed files with 47 additions and 9 deletions

View File

@@ -1,3 +1,9 @@
<p>an autolink <a href="http://example.com">http://example.com</a></p>
<p>inside of parentheses (<a href="http://example.com">http://example.com</a>)</p>
<p>trailing slash <a href="http://example.com/">http://example.com/</a> and <a href="http://example.com/path/">http://example.com/path/</a></p>
<p><a href="http://www.google.com/search?q=Markup+(business)">http://www.google.com/search?q=Markup+(business)</a></p>
<p><a href="http://www.google.com/search?q=Markup+(business)">http://www.google.com/search?q=Markup+(business)</a>))</p>
<p>(<a href="http://www.google.com/search?q=Markup+(business)">http://www.google.com/search?q=Markup+(business)</a>)</p>
<p>(<a href="http://www.google.com/search?q=Markup+(business)">http://www.google.com/search?q=Markup+(business)</a></p>
<p>trailing slash <a href="http://example.com/">http://example.com/</a> and <a href="http://example.com/path/">http://example.com/path/</a></p>
<p>trailing paren <a href="https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)">https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)</a></p>
<p>complex link <a href="http://elk.canda.biz/app/kibana#/discover?_g=()&amp;_a=(columns:!(_source),index:&#039;deve-*&#039;,interval:auto,query:(query_string:(analyze_wildcard:!t,query:&#039;*&#039;)),sort:!(&#039;@timestamp&#039;,desc))">http://elk.canda.biz/app/kibana#/discover?_g=()&amp;_a=(columns:!(_source),index:'deve-*',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'*')),sort:!('@timestamp',desc))</a></p>

View File

@@ -2,4 +2,16 @@ an autolink http://example.com
inside of parentheses (http://example.com)
trailing slash http://example.com/ and http://example.com/path/
http://www.google.com/search?q=Markup+(business)
http://www.google.com/search?q=Markup+(business)))
(http://www.google.com/search?q=Markup+(business))
(http://www.google.com/search?q=Markup+(business)
trailing slash http://example.com/ and http://example.com/path/
trailing paren https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
complex link http://elk.canda.biz/app/kibana#/discover?_g=()&_a=(columns:!(_source),index:'deve-*',interval:auto,query:(query_string:(analyze_wildcard:!t,query:'*')),sort:!('@timestamp',desc))