mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-11 05:44:45 +00:00
Unable to set AutoIdentifierOptions to None / disable #238
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @olafdemol on GitHub (Nov 7, 2018).
var pipeline = new MarkdownPipelineBuilder() .UseAutoIdentifiers(Markdig.Extensions.AutoIdentifiers.AutoIdentifierOptions.None) .Build();Does not seem to do anything compared to Default or any of the other options. Maybe something is broken? My use case is that I want to use all of the AdvancedExtensions but disable the auto-identifier option.
@xoofx commented on GitHub (Nov 7, 2018):
new MarkdownPipelineBuilder();will build only a CommonMark pipeline without any advanced extensions.If you want to remove one extension, you could just create a builder with advanced, and remove the extension manually, something like this:
There is a missing method
pipeline.Extensions.Remove<AutoIdentifierExtension>();but otherwise, you should be able to do what you are looking for.@olafdemol commented on GitHub (Nov 8, 2018):
Thanks for the quick reply!
One thing I'm wondering about is what
Markdig.Extensions.AutoIdentifiers.AutoIdentifierOptions.Noneactually does. In my case it did not seem to be any different fromMarkdig.Extensions.AutoIdentifiers.AutoIdentifierOptions.Default. I assumed none would mean the option was disabled, however it acts the same as default. Is this a bug? (I was not using.UseAdvancedExtensions()in this case).@Kryptos-FR commented on GitHub (Nov 8, 2018):
I guess it is just here because the enum is a flag and it is recommended to always define (name) the
0value. That said I would have named itUndefinedto make sure nobody uses it.Alternatively the
UseAutoIdentifiersextension method could just check the option and if it isNonedo not add (or even remove in case it was already added).@olafdemol commented on GitHub (Nov 8, 2018):
Exactly, if I have time this weekend I'll write up a PR.
@xoofx commented on GitHub (Nov 8, 2018):
Not sure I want to change the name (it would be a breaking change). We should maybe better just throw an exception if None is passed.
@stevehurcombe commented on GitHub (Nov 8, 2018):
...but that too would be a breaking change, a worse one because it's at runtime instead of compile time. Probably best to update the documentation or rename it. It's an easy compile time edit.
@xoofx commented on GitHub (Nov 8, 2018):
yes, that's true 😉... so let's keep it as it is today with a proper comment on the None enum.