preserve Markdown reference links#8717
Conversation
Fixes: #5820 Adds new arguments to the ProseMirror link mark to persist information that the link was in reference syntax in Markdown. Augments the prosemirror-markdown Markdown serializer to carry references that get rendered in the serialized Markdown after the document content. Signed-off-by: Jonas <jonas@freesources.org>
6cb1728 to
101090a
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
max-nextcloud
left a comment
There was a problem hiding this comment.
Just some minor comments. Other than that looks good.
| expect(markdownThroughEditor('[bar\\\\]: /uri\n\n[bar\\\\]')).toBe( | ||
| '[bar\\\\](/uri)', | ||
| ) | ||
| const test2703 = '[bar\\\\]\n\n[bar\\\\]: /uri\n' |
There was a problem hiding this comment.
This has a different order than the original issue. Does it also pass with the original order:
[bar\\]: /uri
[bar\\]| const test2703 = '[bar\\\\]\n\n[bar\\\\]: /uri\n' | |
| const test2703 = '[bar\\\\]: /uri\n\n[bar\\\\]\n' |
| }, | ||
| ) | ||
| return ( | ||
| body.replace(/\s*$/, '') + '\n\n' + referenceLines.join('\n') + '\n' |
There was a problem hiding this comment.
I suspect the replace is meant to remove dangling newlines so we always have one empty line.
It also removes other dangling whitespace:
"hello \nworld \n\n".replace(/\s*$/, '')
"hello
world"
Not sure if that is an issue. Two spaces at the end of a line is valid markdown for a hard break. However I think we serialize that to a <br> tag anyways.
Does the meaning of quotes or lists change if they have no content?
For example * -> * - is the latter still a list?
Fixes: #5820
Adds new arguments to the ProseMirror link mark to persist information that the link was in reference syntax in Markdown.
Augments the prosemirror-markdown Markdown serializer to carry references that get rendered in the serialized Markdown after the document content.
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)🤖 AI (if applicable)