i'm going to do a shameless plug for my github project here because it's quite related but not large enough to dedicate an entire thread to it. it converts DOM > markdown on the client.
I ended up writing a Markdown plugin to a client-side WYSIWYG editor. I needed the ability to store formatted text in MS SQL without either uploaded a binary blob (.doc/.pdf) or using a WYSIWYG with HTML output.
Markdown is exactly what we needed but there weren't any good JS WYSIWYG editors available, so I hacked one together.
yes, line breaks are oddballs. it was especially fun in my testing since every markdown > html converter treats whitespace differently and it's possible to have many extra text nodes as well as leading trailing whitespace, etc. makes testing a faithful round trip very difficult indeed. and then there are different flavors to account for...
https://github.com/leeoniya/reMarked.js
the stated goal is to integrate into existing WYSIWYG html editors to produce markdown output. kind of like Markdownify, but on the client.
yay markdown! :D