qjebbs / vscode-markdown-extended

Extended syntaxes to built-in markdown & What you see is what you get exporter.
MIT License
123 stars 25 forks source link

Indentation is lost when formatting tables and code spans containing column delimiters are not handled correctly #138

Closed rbolsius closed 1 year ago

rbolsius commented 2 years ago

I have run across two issues when formatting tables.

  1. If the table is part of a list and is indented, the indentation is lost when formatting the table.
  2. If the table contains a code span that includes a pipe character (|), the pipe within the code span is treated as a column separator.

The example Markdown below illustrates both of these issues.

1. Indented table:

    |   one | two                        |
    | ----: | -------------------------- |
    |     1 |                            |
    |    12 | abc \| def                 |
    |   123 | abc `|` def                |
    |  1234 | ``double | ` backtick``    |
    | 12345 | ```triple | `` backtick``` |

When this table is formatted the indentation is lost and the second column is split into two columns:

1. Indented table:

|   one | two        |                |
| ----: | ---------- | -------------- |
|     1 |            |                |
|    12 | abc \| def |                |
|   123 | abc `      | ` def          |
|  1234 | ``double   | ` backtick``   |
| 12345 | ```triple  | `` backtick``` |