Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve markdown implementation for italic/bold handling (edge cases) #16

Open
marijnh opened this issue Nov 28, 2017 · 1 comment
Open

Comments

@marijnh
Copy link
Member

marijnh commented Nov 28, 2017

(Originally reported by @Mobiletainment as ProseMirror/prosemirror#730)

Issue details

When putting italic and bold text directly next to each other, there's a good chance that it gets interpreted wrongly due to weaknesses in markdown's italic and bold formatting.

Steps to reproduce

Take the following markdown for example:

*italic text directly next to ***bold text**

  • Expected output: italic text directly next to bold text
  • Actual output: *italic text directly next to *bold text

Please specify which version of ProseMirror you're running

ProseMirror v0.10.1
ProseMirror example at http://prosemirror.net/examples/markdown/ (as of 28th November 2017)

Affected platforms

  • all

Screenshots / Screencast (Optional)

prosemirror-markdown

I tested this behavior with other markdown implementations and saw that this edge case is properly handled by some, e.g. pandoc: http://johnmacfarlane.net/babelmark2/?text=*italic+text+directly+next+to+***bold+text**

prosemirror markdown

@marijnh
Copy link
Member Author

marijnh commented Nov 28, 2017

The problem is that a ProseMirror document can represent documents that can't be represented in Markdown text. CommonMark is pretty clear on where a delimiter must be parsed as closing strong or emphasized text, and directly after whitespace it shouldn't.

We could try to add magic to the Markdown serializer to fix up sitations like this by moving the space outside of the marked range. I don't think that can be done perfectly, but even losing some information is better than outputting bogus Markdown text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant