Skip to content

Commit

Permalink
Merge pull request #260 from MihaZupan/fix-autolinks
Browse files Browse the repository at this point in the history
Allow #, ? and : instead of only / as the domain separator for AutoLinks
  • Loading branch information
xoofx authored Oct 25, 2018
2 parents 07e6a13 + ecd625d commit 92b06f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/Markdig.Tests/Specs/AutoLinks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Extensions
# Extensions

This section describes the different extensions supported:

Expand Down Expand Up @@ -219,4 +219,24 @@ Domain names that contain invalid characters (not AlphaNumberic, -, _ or .) won'
https://[your-domain]/api
.
<p>https://[your-domain]/api</p>
````````````````````````````````

Domain names followed by ?, : or # instead of / are matched

```````````````````````````````` example
https:?
https:?a
https:#a
https::
https::443
.
<p><a href="https:">https:</a>?</p>
<p><a href="https:?a">https:?a</a></p>
<p><a href="https:#a">https:#a</a></p>
<p><a href="https:">https:</a>:</p>
<p><a href="https::443">https::443</a></p>
````````````````````````````````
2 changes: 1 addition & 1 deletion src/Markdig/Helpers/LinkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ public static bool IsValidDomain(string link, int prefixLength)

if (!c.IsAlphaNumeric())
{
if (c == '/') // End of domain name
if (c == '/' || c == '?' || c == '#' || c == ':') // End of domain name
break;

if (c == '_')
Expand Down

0 comments on commit 92b06f0

Please sign in to comment.