Prosemirror-Markdown + Tables?

Hello,

I’m just getting started with Prosemirror Markdown (it’s awesome!) using the prosemirror-example-setup package, and I was wondering if/how it’s possible to add tables via the menu bar that can be serialized into markdown table syntax? Can the prosemirror-tables package be used with prosemirror-markdown?

Thank you

1 Like

This is probably not all that easy and might involve some pull requests to the tables package to allow turning off of features like column and row spans that, at a glance, it looks like markdown tables don’t support. You’ll also need to write the markdown serializer and deserializer for the table nodes. But in principle it should be possible.

Thank you, @marjin !

Is there a guide/examples on writing your own markdown serializer and deserializer instead of using the defaultMarkdownSerializer / defaultMarkdownParser from the prosemirror-markdown package?

The readme for the module has docs on this. You can see how the built-in serializer and deserializer is defined in the src/to_markdown.js and src/from_markdown.js files.

1 Like

Great - I’ll take a look at those. Thanks again!

@sudo Did you have any progress? I am starting to make a table serializer.

1 Like

The default markdown-it table plugin produces a format which is hard to map with prosemirror-table. We created https://github.com/torifat/markdown-it-table to solve this problem.

2 Likes

@jiewuza , not yet, so that’s exciting news

@rifat , looks cool, thanks - will def give that a try

Does anyone have a working example or sample repo with prosemirror-markdown and table working?