Byron / pulldown-cmark-to-cmark

Convert pulldown-cmark Events back to the string they were parsed from
https://docs.rs/crate/pulldown-cmark-to-cmark
Apache License 2.0
43 stars 37 forks source link

End of code block sometimes not indented correctly #69

Closed msrd0 closed 1 day ago

msrd0 commented 4 months ago

When code blocks are part of lists, their three backticks need to be indented (as well as its content). When using an input like this one, pulldown-cmark produces multiple text events inside the code block, each ending with a newline. This gets rendered correctly.

However, when you accidentally remove those newlines, this crate suddenly stops indenting the end of code block correctly. It produces the content of the code block as one long line (which makes sense), adding a newline and then the end of code block without indentation.

While producing codeblock content without final newlines might not be an expected input, I feel like this crate should still indent everything correctly.

Byron commented 4 months ago

Thanks for reporting! A contribution with a fix will definitely be appreciated.