Skip to content

Commit

Permalink
Merge pull request #213 from caioproiete/add-new-use-extension-with-i…
Browse files Browse the repository at this point in the history
…nstance

Add alternative `Use` extension method to `MarkdownPipelineBuilder` that receives an object instance
  • Loading branch information
xoofx authored Feb 23, 2018
2 parents f77bd0b + fea2ca5 commit ad18514
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Markdig/MarkdownExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ public static class MarkdownExtensions
return pipeline;
}

/// <summary>
/// Adds the specified extension instance to the extensions collection.
/// </summary>
/// <param name="pipeline">The pipeline.</param>
/// <param name="extension">The instance of the extension to be added.</param>
/// <typeparam name="TExtension">The type of the extension.</typeparam>
/// <returns>The modified pipeline</returns>
public static MarkdownPipelineBuilder Use<TExtension>(this MarkdownPipelineBuilder pipeline, TExtension extension) where TExtension : class, IMarkdownExtension
{
pipeline.Extensions.AddIfNotAlready(extension);
return pipeline;
}

/// <summary>
/// Uses all extensions except the BootStrap, Emoji, SmartyPants and soft line as hard line breaks extensions.
/// </summary>
Expand Down

0 comments on commit ad18514

Please sign in to comment.