mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-04 05:44:50 +00:00
Indentation Removed From Code Block Inside Custom HtmlObjectRenderer #216
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 @basiphobe on GitHub (Aug 27, 2018).
Hi,
I've created an extension that converts custom markdown elements (i.e. [note blah]...[/note]) into figure elements (i.e.
<figure><figcaption>blah</figcaption>...</figure>). My parser implementsFencedBlockParserBasewith a custom object that implementsContainerBlockandIFencedBlock, and my renderer implementsHtmlObjectRendererwith the same custom object. I'm not sure if that's the best way to do things or not, but it's working pretty well.The only problem I'm having is that indentation is being stripped from any code blocks that exist within the custom markdown element. Here's the markdown code (using images to avoid github markdown rendering):
Without my extension loaded, code block indentation is in place, and the output looks like this:
With my extension loaded, indentation is removed, and the output looks like this:
I suspect the
WriteChildrencall in myWritemethod is the problem:Any suggestions on getting the indentation to remain intact when writing out the custom html?