tommoor / slate-md-serializer

A Markdown serializer for the Slate editor framework
MIT License
64 stars 36 forks source link

Markdown generated for tables cannot be parsed by other parsers #40

Open olipo186 opened 4 years ago

olipo186 commented 4 years ago

Hi,

I'm using https://github.com/outline/rich-markdown-editor and have encountered a problem in the way that tables are rendered to markdown.

Currently, when using the editor to create a table, the generated markdown can end up looking like this;

Hello
| a | b |
|---|---|
| c | d |
world

Unfortunately, this markdown cannot be parsed by most markdown parsers (please see this comparison made with Babelmark showing that it only works in 4 implementations).

As it seems, most markdown parsers expect tables to be wrapped by newlines. By wrapping the table in newline characters, the same table is rendered correctly in 14 implementations. Some implementations still fails to render the table however, but this is because those markdown implementations lack table support whatsoever.

Hello

| a | b |
|---|---|
| c | d |

world

I think that rich-markdown-editor and slate-md-editor should set a goal to generate markdown that complies with established conventions and wide used specifications (such as the CommonMark spec) whenever possible.