/// <summary> /// Turns all URLs and e-mail addresses into clickable links. /// </summary> /// <param name="htmlAttributes">Adds HTML attributes to the links.</param> /// <param name="textReplacer">Lambda expression to change what text is shown inside the link tag.</param> /// <param name="linkMode">Option to limit what should be linked.</param> public static string AutoLink(this string text, IDictionary <string, string> htmlAttributes = null, Func <string, string> textReplacer = null, LinkMode linkMode = LinkMode.All) { textReplacer = textReplacer ?? (x => x); var replacer = new AutoLinkReplacer(htmlAttributes, textReplacer, linkMode); return(replacer.Replace(text)); }
/// <summary> /// Turns all URLs and e-mail addresses into clickable links. /// </summary> /// <param name="htmlAttributes">Adds HTML attributes to the links.</param> /// <param name="textReplacer">Lambda expression to change what text is shown inside the link tag.</param> /// <param name="linkMode">Option to limit what should be linked.</param> public static string AutoLink(this string text, IDictionary<string, string> htmlAttributes=null, Func<string, string> textReplacer=null, LinkMode linkMode=LinkMode.All) { textReplacer = textReplacer ?? (x => x); var replacer = new AutoLinkReplacer(htmlAttributes, textReplacer, linkMode); return replacer.Replace(text); }