Closed ahelwer closed 10 months ago
There are actually quite a few places where newlines are deleted, changing the formatting (sticking paragraphs together and such).
@ahelwer, works for me. I guess you are experiencing #64 rather than a problem with MarkdownRenderer
. Can you please confirm?
I don't think so, I'm on Linux and running file -k test.md
outputs test.md: ASCII text
so the line endings are just \n
.
I'm sorry, looking at it again and I am actually able to reproduce. And it looks like you are experiencing #56 then. :)
I.e. change your code to the following and the MarkdownRenderer
will work correctly (because the renderer will manage to add its BlankLine
and other tokens to the parsing process):
from mistletoe import Document
from mistletoe.markdown_renderer import MarkdownRenderer
with MarkdownRenderer() as r:
with open('test.md', 'r') as f:
d = Document(f)
with open('test.md', 'w') as f:
f.write(r.render(d))
So I'm closing this as answered. Feel free to reopen by commenting on this issue.
Using latest version 1.2.1. Here's a simple round-trip python script:
If I run this script on this markdown file:
it will output:
if I run it again on this output, it will produce:
So the text has become part of the final list item, changing the document layout. The same behavior is also exhibited with ordered lists.