mirror of
https://github.com/xoofx/markdig.git
synced 2026-04-23 22:19:25 +00:00
[PR #216] [CLOSED] Changed: Configure extensions by reflection #874
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?
📋 Pull Request Information
Original PR: https://github.com/xoofx/markdig/pull/216
Author: @nea
Created: 3/2/2018
Status: ❌ Closed
Base:
master← Head:configure-extensions-by-reflection📝 Commits (4)
cf39008Changed: Configure now looks for extension classes to build its pipeline47ae9b6Added: Special handling for nohtml1d01bb6Changed: Tests to match extension class names for consistency with new Configure method9efc00cChanged: Added parameterless constructors to Extensions for easier use with Configure as well as the new Use<> implementation📊 Changes
12 files changed (+241 additions, -150 deletions)
View changed files
📝
src/Markdig.Tests/Markdig.Tests.csproj(+1 -0)📝
src/Markdig.Tests/Specs/Specs.cs(+50 -50)📝
src/Markdig.Tests/Specs/Specs.tt(+7 -7)➕
src/Markdig.Tests/TestMarkdownExtensions.cs(+64 -0)📝
src/Markdig.Tests/TestPlayParser.cs(+1 -1)📝
src/Markdig.Tests/TestSourcePosition.cs(+4 -4)📝
src/Markdig/Extensions/AutoIdentifiers/AutoIdentifierExtension.cs(+6 -0)📝
src/Markdig/Extensions/Emoji/EmojiExtension.cs(+2 -0)📝
src/Markdig/Extensions/EmphasisExtras/EmphasisExtraExtension.cs(+5 -0)📝
src/Markdig/Extensions/JiraLinks/JiraLinkExtension.cs(+2 -2)📝
src/Markdig/Markdig.csproj(+3 -2)📝
src/Markdig/MarkdownExtensions.cs(+96 -84)📄 Description
Hey
This PR is a suggestion for something further in the future.
I changed to the MarkdownExtensions.Configure() method to work with reflection, therefore grabbing all classes implementing the IMarkdownExtension interface and adding them to the pipeline if configured.
I thought of this to be a little more flexible also in the future without having to adapt the switch/case all the time.
But: I know the change is drastic! And it's not 100% backwards compatible to previous Configure() strings as I work with the extension class name which isn't the same as in the switch case for every plugin.
I adapted the tests accordingly and also added a small test for my changes.
I am open for feedback and suggestions as I would be happy to have this system as flexible as possible to use in the future.
Thanks
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.