valentjn / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
817 stars 29 forks source link

markdown: Accept whitespace in tables #605

Open Reissner opened 2 years ago

Reissner commented 2 years ago

Is your feature request related to a problem? Please describe. In a markdown label it makes the structure clearer if the columns, i.e. the separator symbols | are aligned. To reach this, the cell content must be padded with spaces. If left aligned the spaces come at the right hand side and the other way round. If formatted that way, ltex detects violation of whitespace rule which i consider a false positive in a sense.

Describe the solution you'd like I would like to suggest to weaken the whitespace rule: Outside a cell of a table it shall be as it is. (trailing whitespace in a line representing a row of a table shall be a violation) Inside the cell of a table trailing whitespaces shall be allowed for left aligned cells and leading whitespaces for right aligned cells. For centered cells both shall be allowed.

Describe alternatives you've considered Well, maybe just inside tables both trailing whitespaces and leading whitespaces shall be allowed.

Additional context I think this is not needed in this case.

gusbemacbe commented 2 years ago

LTEX misunderstands Markdown grid tables and thinks everything is a mistake:

image

+----------------------------+------------------------------+
| Markdown                   | HTML                         |
+============================+==============================+
| `# Cabeçalho nível 1`      | `<h1>Cabeçalho nível 1</h1>` |
+----------------------------+------------------------------+
| `## Cabeçalho nível 2`     | `<h2>Cabeçalho nível 2</h2>` |
+----------------------------+------------------------------+
| `### Cabeçalho nível 3`    | `<h3>Cabeçalho nível 3</h3>` |
+----------------------------+------------------------------+
| `#### Cabeçalho nível 4`   | `<h4>Cabeçalho nível 4</h4>` |
+----------------------------+------------------------------+
| `##### Cabeçalho nível 5`  | `<h5>Cabeçalho nível 5</h5>` |
+----------------------------+------------------------------+
| `###### Cabeçalho nível 6` | `<h6>Cabeçalho nível 6</h6>` |
+----------------------------+------------------------------+
exploids commented 1 year ago

Pandoc's simple_tables and multiline_tables also cause WHITESPACE_RULE errors.

simple_tables

  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1

multiline_tables

-------------------------------------------------------------
 Centered   Default           Right Left
  Header    Aligned         Aligned Aligned
----------- ------- --------------- -------------------------
   First    row                12.0 Example of a row that
                                    spans multiple lines.

  Second    row                 5.0 Here's another one. Note
                                    the blank line between
                                    rows.
-------------------------------------------------------------