Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
 /// <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);
 }