preservim / vim-markdown

Markdown Vim Mode
4.68k stars 521 forks source link

Fix TableFormat for indented tables #569

Closed tomtomjhj closed 2 years ago

tomtomjhj commented 2 years ago

Problem: TableFormat adds hyphens at the left of the indented table like this:

  | a | b |
--|---|---|
  | x | y |

Solution: Replace only the spaces between pipes.

alerque commented 2 years ago

I do appreciate the contribution, but this actually raised a problem. Honestly I didn't check the test suite when I merged this but I should have because it caught the problem. This may fix tables with indentation, but it breaks table formatting for non-indented tables.

I have reverted this commit so that we can get CI tests working, but it would be nice to take another pass at this issue and find something that works to fix this problem but doesn't break anything else. Also we can add a test for this scenario so we make sure it doesn't break in the future either.