Consider introducing generic extension registry method to MarkdownPipelineBuilder #78

Closed
opened 2026-01-29 14:25:20 +00:00 by claunia · 1 comment
Owner

Originally created by @christophano on GitHub (Dec 15, 2016).

While I like having specific extension methods to load specific extensions onto the pipeline builder, it is also handy not to have to create an extension method for every extension I create.
To that end, I tend to use a single extension method for registering simple extensions.

Would you consider including this method on the MarkdownPipelinBuilder class itself? Happy to complete a pull request for this.

Method:

public MarkdownPipelineBuilder Use<TExtension>() where TExtension : class, IMarkdownExtension, new()
{
    Extensions.AddIfNotAlready<TExtension>();
    return this;
}

Usage:

var pipeline = new MarkdownPipelineBuilder()
    .Use<AwesomeExtension>()
    .Build();
Originally created by @christophano on GitHub (Dec 15, 2016). While I like having specific extension methods to load specific extensions onto the pipeline builder, it is also handy not to have to create an extension method for _every_ extension I create. To that end, I tend to use a single extension method for registering simple extensions. Would you consider including this method on the `MarkdownPipelinBuilder` class itself? Happy to complete a pull request for this. Method: ```cs public MarkdownPipelineBuilder Use<TExtension>() where TExtension : class, IMarkdownExtension, new() { Extensions.AddIfNotAlready<TExtension>(); return this; } ``` Usage: ```cs var pipeline = new MarkdownPipelineBuilder() .Use<AwesomeExtension>() .Build(); ```
claunia added the enhancement label 2026-01-29 14:25:20 +00:00
Author
Owner

@xoofx commented on GitHub (Dec 15, 2016):

Sure it is a good idea to add this.

@xoofx commented on GitHub (Dec 15, 2016): Sure it is a good idea to add this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#78