yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.94k stars 326 forks source link

Support auto-formatting white space around grid tables #1163

Open janosh opened 2 years ago

janosh commented 2 years ago

Proposal

Support auto-formatting grid tables.

References

This is part of pandoc, not part of the GFM spec.

Motivation

grid-tables offer a few advantages such as better multiline support than GFM tables and headerless tables.

Expected behavior

Auto-format something like

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper     |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+

to this

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+
yzhang-gh commented 2 years ago

Thanks for the suggestion. However, as it is not supported in (almost all 🤔) Markdown editors, I think it is better to have a Pandoc extension for this.