/// <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; } }
/// <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); } }
/// <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); }