adamerose / vscode-markdown-wysiwyg

https://marketplace.visualstudio.com/items?itemName=adamerose.markdown-wysiwyg
Other
19 stars 4 forks source link

Comments are removed after save #5

Open marcvg opened 1 year ago

marcvg commented 1 year ago

Hi, great job on the MD editor!

One issue we've encountered: commented out lines are removed form MD file after save.

Eg. Following commented out section we use to convert MD to Confluence pages disappears:

Table of content \<!-- Confluence TOC --> \<!-- {toc:minLevel=2} -->

Cheers, Marc.

adamerose commented 1 year ago

This problem is because CKEditor5 takes the entire contents of the WYSIWYG editor and generates markdown output from that. Since comments don't have any visual representation in the editor, they will not be in the output. I've created an issue upstream here.

I'll wait and see if the CKE5 team is willing to change this behavior, otherwise I think a fix on my end would be to keep track of which nodes are changed with an event listener and then merge the file contents with the editor output, keeping the editor output only where changes have been made.