Of course Markdown -> HTML is what every markdown library does, including parsedown which we use in Grav. This is not the issue. The problem is that there is no good WYSIWYG editors in markdown that reliably save as markdown.
HTML -> Markdown however, is very hard to do properly, and no editor or library is doing it ‘safely’…
Pretty much every WYSIWYG that gets mentioned is simply an HTML editor, the ‘raw’ format is HTML, that is what gets saved. For Grav this is less than ideal, because we feel markdown is a better format for writing content. WYSIWYG Editors that purport to support markdown run through a very simplistic parser where if something has a direct match to markdown (eg link, strong, italic, headers, etc), that gets converted to markdown, and everything else is thrown away.
With the code-style editor we have now in Grav admin, you can put markdown, twig, shortcodes, and even mix that with HTML where you need it. Anything that was not pure markdown (common mark usually), is lost, as in gone forever! This is a dangerous scenario for any Grav users that has a site they are happy with, installs WYSIWYG editor, saves, and now has a bunch of content just missing, or the page is left broken simply because the editor didn’t know how to parse something to markdown.
Even the cutting edge WYWIWM editors (notice the trailing M) like ProseMirror don’t solve this problem. So there is really no way to keep the power we have already when you implement a WYSIWYG editor that saves as markdown.
The only alternative we have at this point is to simply store the content as HTML after you use an editor of this type. That way extra HTML is usually not visualized, but it’s not lost either. Of course this means that your Markdown content is then left as HTML, and you pretty much have to use the WYSIWYG editor from this point on or you will be left editing ugly HTML.
The other downside of this was the loss of important core Grav functionality like the media manipulation, link translation etc. We have moved these out of the Parsedown extension we had originally, so we have opened up the possibility to enable these in a sufficiently extensible WYSIWG editor via an Ajax call. But other plugins that provide markdown extensions are simply going to be unusable.
If anyone has a better idea or can prototype a decent solution, i’m all ears!