Closed buddh4 closed 4 years ago
Could you describe more precisely what you are doing? Adding an image after a space to the document in the ProseMirror editor on https://prosemirror.net/examples/markdown/ and then switching to markdown doesn't do anything unexpected.
Sorry, here some infos how to reproduce:
The result in my screenshot above (with the ``` block) happens only if you again switch back to Markdown. The problem is that 4+ spaces at the beginning of a line will be interpreted as code block which is normal markdown syntax, but breaks wysiwyg in this case.
Ah, okay, that doesn't appear to be related to images, since the same thing happens with text. It seems Markdown doesn't provide a way to escape spaces, and requires parsers to strip leading spaces. So there's not much this serializer can do to preserve those.
More generally, having spaces at the start of a paragraph like that suggests you're trying to do layout with spaces, which is rarely a good idea anyway (HTML will collapse them, for example).
Yeah, just thought there maybe was an easy way of escaping such cases. Its not me who wants to use spaces for layouting, but for normal users this is rather unexpected.
I thought about following solutions:
Anyways, thanks for your feedback.
Markdown, unfortunately, turns out to be somewhat problematic as a serialization format when users aren't directly writing it, since it has a bunch of these corner cases that make some documents unrepresentable.
I don't think I'll be able to address this one at in this module, so I'm closing this issue.
When adding spaces before an image in the wysiwyg the image markdown will be wrapped in a code block. How could we escape such a case?