New markdown library: remark-prosemirror

@handlewithcare/remark-prosemirror

Hi folks! Lately I’ve been working on some projects that needed to be able to convert back and forth between ProseMirror and Markdown (most notably, moment.dev). There’s an existing first party solution for this, prosemirror-markdown, which uses markdownit as the underlying markdown processor. Unfortunately, in our case, we needed to incorporate additional extensions into the markdown syntax for some features, which felt challenging and clunky with markdownit, partly due to the lack of syntax tree.

Instead, we ended up looking at the unified ecosystem. It was more straightforward to extend various parts of the parser, serializer, and syntax tree processors, which met our needs better. To support integrating with ProseMirror, I ended up developing a remark plugin that converts markdown to ProseMirror documents, and an mdast utility that converts ProseMirror documents to mdast (Markdown Abstract Syntax Tree)!

Maybe this will be useful for other folks, maybe not, but I figured I would share! Don’t hesitate to reach out if you have questions!

Very nice! I considered switching prosemirror-markdown to another parser when markdown-it took years and years to ship ES modules, but figured it would be too much of a breaking change. I’m glad this exists now.

1 Like