-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Serialization to markdown fails when two marks start or end in the same position #216
Comments
Thanks for the bug report @katemihalikova! I was able to reproduce this as well. We'll need to look into how the document is being transformed to Markdown, and whether it's a bug in PM or something to do with markdown-it, our Markdown utility library. |
It's almost certainly our serializer — markdown-it has been very solid so far. If someone knows of a Markdown-generation library (the escaping is non-trivial), I'd gladly switch to that. If it doesn't exist, we'll just have to continue shaping up ours. |
I've observed this behavior but was unable to pin down the source until now. Looking at the code for Firstly, i'm not sure why the check for a code mark gets special treatment, but I think the The more general problem seems to be that the stack is always traversed from |
I was diagnosing this at the same time. Yep, that's the problem. |
Can you comment on the |
#235 fixes the first and third test cases. It seems the second text case will be trickier to fix.
Yes, good find. Can you open up a separate issue and perhaps a pull request with the change? |
I think what we're looking for is a library that supports an abstract syntax tree data type for Markdown (which we can transform our document model into), which also supports converting the AST to Markdown. This would be very desirable given the second test case originally shared on this issue. Briefly Googled around for this today. commonmark.js already has an AST representation, and is discussing adding AST → Markdown support. |
The code still isn't great -- it hard-codes a mark name, which it should not be doing -- but at least it sort of works now. Issue #216
Attached patches, along with b43d167, should address this issue. |
Steps to reproduce
Bold text:
![image](https://cloud.githubusercontent.com/assets/7225023/13292315/8999e83e-db1b-11e5-9588-838db2e7b37e.png)
![image](https://cloud.githubusercontent.com/assets/7225023/13292447/11d8bd56-db1c-11e5-9250-e3ed59227994.png)
![image](https://cloud.githubusercontent.com/assets/7225023/13292546/7dd34da0-db1c-11e5-83bc-0f1412fa26ac.png)
![image](https://cloud.githubusercontent.com/assets/7225023/13292522/6900a6de-db1c-11e5-82f6-a659e14c896e.png)
![image](https://cloud.githubusercontent.com/assets/7225023/13292463/2584c0fc-db1c-11e5-955c-1c1198c9ca03.png)
![image](https://cloud.githubusercontent.com/assets/7225023/13292555/85530976-db1c-11e5-8fd7-d8de2dd17807.png)
![image](https://cloud.githubusercontent.com/assets/7225023/13292595/a5a99a5a-db1c-11e5-9fe5-4decfa17a65c.png)
Link/code added to one of the words:
The markdown output contains mixed marks:
Version
Detected in v0.3.0 and v0.4.0, using Windows Chrome 48. Most recent commit is the v0.4.0 now.
The text was updated successfully, but these errors were encountered: