Esempio n. 1
0
        /// <summary>
        /// Autoes the link.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="opts">The opts.</param>
        /// <param name="hrefattrs">The hrefattrs.</param>
        /// <returns></returns>
        public static string AutoLink(string text, AutoLinkOptions opts, string hrefattrs)
        {
            if (string.IsNullOrEmpty(text)) return text;

            switch (opts)
            {
                case AutoLinkOptions.All:
                    return AutoLinkEmailAddresses(AutoLinkUrls(text, hrefattrs));
                case AutoLinkOptions.Email:
                    return AutoLinkEmailAddresses(text);
                case AutoLinkOptions.Url:
                    return AutoLinkUrls(text, hrefattrs);
                default:
                    return text;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Autoes the link.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="opts">The opts.</param>
        /// <param name="hrefattrs">The hrefattrs.</param>
        /// <returns></returns>
        public static string AutoLink(string text, AutoLinkOptions opts, string hrefattrs)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(text);
            }

            switch (opts)
            {
            case AutoLinkOptions.All:
                return(AutoLinkEmailAddresses(AutoLinkUrls(text, hrefattrs)));

            case AutoLinkOptions.Email:
                return(AutoLinkEmailAddresses(text));

            case AutoLinkOptions.Url:
                return(AutoLinkUrls(text, hrefattrs));

            default:
                return(text);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Uses this extension to enable autolinks from text `http://`, `https://`, `ftp://`, `mailto:`, `www.xxx.yyy`
 /// </summary>
 /// <param name="pipeline">The pipeline.</param>
 /// <param name="options">The options.</param>
 /// <returns>The modified pipeline</returns>
 public static MarkdownPipelineBuilder UseAutoLinks(this MarkdownPipelineBuilder pipeline, AutoLinkOptions options = null)
 {
     pipeline.Extensions.ReplaceOrAdd <AutoLinkExtension>(new AutoLinkExtension(options));
     return(pipeline);
 }