Render Markdig CustomContainer admonition blocks#132
Conversation
Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #132 +/- ##
==========================================
+ Coverage 95.64% 95.71% +0.07%
==========================================
Files 28 29 +1
Lines 1606 1635 +29
Branches 171 172 +1
==========================================
+ Hits 1536 1565 +29
Misses 46 46
Partials 24 24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
boxofyellow
left a comment
There was a problem hiding this comment.
@copilot Please address this comment.
Additionally, I have added a new step to guide doc https://github.com/boxofyellow/ConsoleMarkdownRenderer/blob/main/docs/adding_a_new_renderer.md for updating the changelog. Please apply those changes within this PR as well.
Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
Added a changelog entry for this PR under |
Updated image URLs in CHANGELOG with specific dimensions.
New Feature
Markdig parses fenced
:::blocks (admonitions like:::note,:::warning) intoCustomContainer/CustomContainerInlineAST nodes, but the renderer had no handler for them so the content was silently dropped.What does this feature do?
Renders custom containers as a framed block with the
Infolabel (e.g.note) on top, then the children. Inline::tag::spans are also rendered.Implementation details
Followed
docs/adding_a_new_renderer.md:ObjectRenderers/ConsoleObjectRenderers.cs): addedConsoleCustomContainerRenderer(frame + styledInfolabel + children) andConsoleCustomContainerInlineRenderer(styled inline span).ConsoleRenderer.cs): both registered; the inline renderer is placed beforeConsoleEmphasisInlineRenderersinceCustomContainerInline : EmphasisInlineand Markdig picks the first assignable renderer.TextStyleproperties —CustomContainer(body),CustomContainerInfo(label),CustomContainerInline— defaulting to bold for the labels and unstyled for the body.Clone()updated accordingly.customContainer.md/.txtfixture, twoRendererTests_CustomContainer*style assertions, and the three styles added tom_crazyOptions.bracketEscaping.mdwith[test27]–[test29]exercising both block and inline containers;.txtregenerated.example.md.