mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
[PR #802] [CLOSED] Add ConfigureHtmlRenderer to MarkdownPipelineBuilder #1228
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/802
Author: @yngvedh
Created: 6/9/2024
Status: ❌ Closed
Base:
master← Head:configure-renderer📝 Commits (10+)
011f4ebAdd configuration of HtmlRenderer in pipeline builder26064f6Add support for relative base uride4a49cRedo combining of relative urisc68e734Rename ConfigureHtmlRenderer field to resolve name conflicte8aa193Add POC of renderer builders27c64afFlesh out HtmlRendererBuilder1211b73Add NormalizeRendererBuilder1c3afbaAdd RoundtripRendererBuilderef56e52Add missing licensing headersc6521f6Refactor Configure*Renderer pipeline extension methods📊 Changes
14 files changed (+310 additions, -58 deletions)
View changed files
📝
src/Markdig.Tests/RoundtripSpecs/Inlines/TestNullCharacterInline.cs(+7 -8)📝
src/Markdig.Tests/TestLinkRewriter.cs(+5 -9)📝
src/Markdig.Tests/TestRelativeUrlReplacement.cs(+5 -10)📝
src/Markdig.Tests/TestRoundtrip.cs(+6 -10)📝
src/Markdig/Markdown.cs(+3 -3)📝
src/Markdig/MarkdownExtensions.cs(+43 -1)📝
src/Markdig/MarkdownPipeline.cs(+19 -11)📝
src/Markdig/MarkdownPipelineBuilder.cs(+7 -3)📝
src/Markdig/Renderers/HtmlRenderer.cs(+11 -2)➕
src/Markdig/Renderers/HtmlRendererBuilder.cs(+86 -0)➕
src/Markdig/Renderers/IMarkdownRendererBuilder.cs(+22 -0)➕
src/Markdig/Renderers/Normalize/NormalizeRendererBuilder.cs(+66 -0)➕
src/Markdig/Renderers/Roundtrip/RoundtripRendererBuilder.cs(+23 -0)📝
src/Markdig/Renderers/TextRendererBase.cs(+7 -1)📄 Description
I needed to set up image url rewriting in a project of mine and found it a bit tedious not having a way to set it up in the pipeline. So I added the ability to configure the
HtmlRendererfrom the pipeline builder. As an added bonus, this works with the renderer cache as well.I did not add any tests but updated the BaseUrl test to configure the html renderer using the pipeline builder.
I did not update changelog.md since it already has been neglected for some time.
I have not spent any time figuring out whether any of the documentation should be updated, please advise.
I could not find any existing PR or issue on this exact issue so I took the liberty to raise this draft PR.
UPDATE:
I added a bare bones builder for HtmlRenderer letting me set the one field I need as a POC. It is basically a factory for
TextRendererBasewhich I also refactored the cache mechanism to use so that too should work for any text renderer. This goes for theToHtmlmethod since it uses the caching mechanism to get hold of its renderer.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.