From fea2ca5adfa3c6058d53ee38723d98a737a2392c Mon Sep 17 00:00:00 2001 From: Caio Proiete Date: Tue, 20 Feb 2018 19:32:47 -0400 Subject: [PATCH] Add alternative `Use` extension method to `MarkdownPipelineBuilder` that receives an object instance --- src/Markdig/MarkdownExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Markdig/MarkdownExtensions.cs b/src/Markdig/MarkdownExtensions.cs index 519b9cd77..c7722162d 100644 --- a/src/Markdig/MarkdownExtensions.cs +++ b/src/Markdig/MarkdownExtensions.cs @@ -51,6 +51,19 @@ public static class MarkdownExtensions return pipeline; } + /// + /// Adds the specified extension instance to the extensions collection. + /// + /// The pipeline. + /// The instance of the extension to be added. + /// The type of the extension. + /// The modified pipeline + public static MarkdownPipelineBuilder Use(this MarkdownPipelineBuilder pipeline, TExtension extension) where TExtension : class, IMarkdownExtension + { + pipeline.Extensions.AddIfNotAlready(extension); + return pipeline; + } + /// /// Uses all extensions except the BootStrap, Emoji, SmartyPants and soft line as hard line breaks extensions. ///