Is there a way to disable an extension? #228

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

Originally created by @JeanCollas on GitHub (Oct 1, 2018).

If we have a "standard" way to create a pipeline, is there a way to remove one or several extensions from this pipeline depending on the context?
For example in some contexts, we may not want to process links.

2nd question linked to the first one, but different :)
Is there an extension that removes links? (for example to forbid totally/censor links in comments)
It would be similar to the http* auto-link, but just making it disappear (we can think of the same for phone numbers, emails etc).

Originally created by @JeanCollas on GitHub (Oct 1, 2018). If we have a "standard" way to create a pipeline, is there a way to remove one or several extensions from this pipeline depending on the context? For example in some contexts, we may not want to process links. 2nd question linked to the first one, but different :) Is there an extension that removes links? (for example to forbid totally/censor links in comments) It would be similar to the http* auto-link, but just making it disappear (we can think of the same for phone numbers, emails etc).
claunia added the question label 2026-01-29 14:30:53 +00:00
Author
Owner

@xoofx commented on GitHub (Oct 7, 2018):

If we have a "standard" way to create a pipeline, is there a way to remove one or several extensions from this pipeline depending on the context?
For example in some contexts, we may not want to process links.

Default CommonMark behavior can be disabled by manipulating the registered InlineParsers and BlockParsers directly on the MarkdownPipelineBuilder

Note that there are quite a few cases where removing a parser can make the pipeline invalid (because there are still a few parser dependencies that are not resolved dynamically, but should, PR welcome for this change)

2nd question linked to the first one, but different :)
Is there an extension that removes links? (for example to forbid totally/censor links in comments)
It would be similar to the http* auto-link, but just making it disappear (we can think of the same for phone numbers, emails etc).

No. But you can either iterate on the resulting markdown document before rendering to HTML... you can try also to remove entirely the parser for them (but note that they would appear as plain text in the output)

@xoofx commented on GitHub (Oct 7, 2018): > If we have a "standard" way to create a pipeline, is there a way to remove one or several extensions from this pipeline depending on the context? > For example in some contexts, we may not want to process links. Default CommonMark behavior can be disabled by manipulating the registered [InlineParsers and BlockParsers](https://github.com/lunet-io/markdig/blob/07e6a13378bbebbe6a47ded05a06be6ed5143daa/src/Markdig/MarkdownPipelineBuilder.cs#L59-L69) directly on the `MarkdownPipelineBuilder` Note that there are quite a few cases where removing a parser can make the pipeline invalid (because there are still a few parser dependencies that are not resolved dynamically, but should, PR welcome for this change) > 2nd question linked to the first one, but different :) Is there an extension that removes links? (for example to forbid totally/censor links in comments) It would be similar to the http* auto-link, but just making it disappear (we can think of the same for phone numbers, emails etc). No. But you can either iterate on the resulting markdown document before rendering to HTML... you can try also to remove entirely the parser for them (but note that they would appear as plain text in the output)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#228