Skip to content

Commit f858710

Browse files
author
balpha
committed
add underscore to the problemUrlChars; encode problem chars in auto-links as well
1 parent e2b2493 commit f858710

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

MarkdownSharp/Markdown.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ private string DoAutoLinks(string text)
15321532
private string HyperlinkEvaluator(Match match)
15331533
{
15341534
string link = match.Groups[1].Value;
1535-
return string.Format("<a href=\"{0}\">{0}</a>", link);
1535+
return string.Format("<a href=\"{0}\">{1}</a>", EncodeProblemUrlChars(link), link);
15361536
}
15371537

15381538
private string EmailEvaluator(Match match)
@@ -1689,7 +1689,7 @@ private static string AttributeEncode(string s)
16891689
return s.Replace(">", "&gt;").Replace("<", "&lt;").Replace("\"", "&quot;");
16901690
}
16911691

1692-
private static char[] _problemUrlChars = @"""'*()[]$:".ToCharArray();
1692+
private static readonly char[] _problemUrlChars = @"""'*()[]$:_".ToCharArray();
16931693

16941694
/// <summary>
16951695
/// hex-encodes some unusual "problem" chars in URLs to avoid URL detection problems

0 commit comments

Comments
 (0)