I’ve already posted this issue in the GitHub repository but I’ve not get a response yet.
It seems there is an issue with cmark_render_commonmark
function. When it gets as an input a document that has a text node with a whitespace in the beginning, it does not return a correct Markdown string.
For example, the following document:
Document node → Paragraph node → Text node with text
literal
is rendered as text\n
, which is a code block.
From looking at some other library that deal with Markdown documents, when converting the AST to Markdown string the whitespace in the beginning of line is replaced with the numeric character reference  
, so could it be fixed in the same way in cmark library?
Thanks