[SuperEditorMarkdown] Attributions not placed according to markdown standard when serializing document (#2424)
Hi @matthew-carroll, hi @angelosilvestre :) Here's a PR with failing tests following up on your comment here. I also added some background below to motivate why I think this is an issue. Thanks again for your support here and I hope I can contribute myself after some guidance!
Background
The AttributedTextMarkdownSerializer places markdown formatting symbols according to the offset of attribution markers. This results in invalid markdown, as the markdown standard doesn't allow leading/trailing whitespaces. The closest official source I find to back my issue of incorrect markdown annoations is the following:
To bold/italicize text, add one/two asterisks before and after a word or phrase. (markdownguide.org)
Also from the examples in the original spec from John Gruber, it's obvious that the annotation should be around a word/phrase and not white space.
GitHub shows ** bold text** and not bold text just as flutter_markdown.
Also from the original spec from John Gruber, it's obvious that the annotation should be around a word/phrase and not white space.
Why is this "obvious"? What specifically are you referring to in the original spec? Neither of your links seem to mention or address the question of spaces at all.
@matthew-carroll Sorry I wanted to refer to the examples, they consistently show the delimiters placed directly around the text without spaces. And you're right it's not obvious at all that it shouldn't be allowed to have whitespaces. But that's what most markdown renderers implemented.
Can you show a few examples of editors that behave the way you're describing here? Namely, editors that aren't using Flutter - editors that have a longer track record and user base.
Sure!
| Editor | Preview |
|---|---|
| VSCode, built-in markdown preview | |
| Typora | |
| StackEdit | |
| Dillinger | |
| GitHub | ** bold text **, bold text |
@matthew-carroll Do you think the serializer should account for this? If not wanted, I will post-edit myself the result after serialization...