-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support fixed-width table alignment row #217
Comments
Because on big tables it creates noise. Setting "paddedTable" to "false" in package.json does 3 things: 1. Disable padding by `remark-stringify` 2. Use fixed width columns: `| --- | --- |` 3. Disable `remark-lint-table-cell-padding` Linting is disabled because `remark-lint-table-cell-padding` has no option (yet) for this particular style. See: remarkjs/remark-lint#217 Prior discussion: #16
🤔 I think this is unrelated to Isn’t this closed to Btw, if I recall correctly, the table rules don’t check the alignment row at all 🤔 |
I should have given a more specific invalid example: | foo | a long column | bar |
| --- | ------------- | --- | |
Its readme states:
So it seems there's currently no way to lint this. |
If I understand correctly, you’d like for the following to be valid: | foo | a long column | bar |
| --- | --- | --- |
| alpha | bravo | charlie | ...right? So this rule/option/feature is only about the alignment row ( |
Right, but that rule is for the padding, e.g., warning if |
Right. I didn't know that the "alignment row" had a name, cool. Does it warrant a separate plugin? |
I don’t think it makes sense to have fixed-width on normal cells, only for the alignment row, sooo, yeah, I think a new rule makes sense... Maybe it’s time to revisit how the alignment row is created when not aligning cells. What’s the reason for three? Why not two? One? Four? |
FWIW when I discovered the
Because three is currently the minimum of |
The
Three is historically the lowest-possible alignment row cell length. Apparently GFMs support is now, after switching to be based upon CM, different: Say this Markdown was used: | 1 dash |
| - |
| a |
| 1 colon |
| : |
| a |
| two colons |
| :-: |
| a |
| colon dash |
| :- |
| a |
| dash colon |
| -: |
| a |
| colon dash colon |
| :-: |
| a | Yields:
| 1 colon |
Is what you’re proposing really about a fixed size of e.g., |
I thought that is what |aaaa|bbbb|
|-|-|
|aaa|bbb|
| aaaa | bbbb |
| ---- | ---- |
| aaa | bbb | The spaces are as expected (due to
Either would work for me, but I guess minimum possible cell size is more sensible. I don't care what the size is, as long as it's stable. In other words, the behavior I'm looking for is that changing the content of a table cell on one line does not affect markdown on other lines (like alignment rows). |
Whoops, I’m confused! 😅 Gah, you‘re right. That’s spaced. Padded is aligning the size of all cells. I think this issue is about the alignment row, which currently, when not padding (as in, aligning), matches that of the first row (the header row). How about this: remark-lint-table-pipe-alignment should have an option to support “aligned” (current behavior), “compact” (use the least space as possible). (And false of course, to not check it). Then
|
Sounds good! There's a secondary issue: the How about also adding a ' |
The previous name was very confusing. Related to remarkjs/remark-lint#217.
* Improve performance * Fix a couple of bugs (such as trailing whitespace) * Remove minimum of three character in alignment row cells — this isn’t needed in Markdown anymore * Don’t double pad empty cells * Fix tests Related to remarkjs/remark-lint#217.
Sooo I’m reading this thread again wondering what I can do to solve it, but it’s really confusing because the terms are all weird: they’re getting better soon in remark though. Both two rules currently do not check the alignment row. That could be a useful feature, but it would add more warnings. Especially what you’re asking at the start: For this to be correct:
And this to be incorrect:
remark-lint-table-pipe-alignment checks whether the pipes align to form a pretty grid. They don’t in either example. And I no longer think a different option (“compact”) makes sense either: there’s either aligned, or not aligned. remark-lint-table-cell-padding has two modes: padded, meaning there’s a space around pipes, which deems the first example as correct and the second as not, or compact, which deems both incorrect. To conform to your ok/nok example:
But due to changes in GitHub-style tables, that were applied to
The values in the aligning cells aren’t checked currently, it’s not really padding, so it only makes sense in a new rule, such as: As this output isn’t currently possible with remark (but soon), I’d say that rule should be “tabled” for now. For tables to be “nicely” aligned in a grid, such as:
The two existing rules ( |
This change updates markdown-table, the library used to serialize markdown tables. With that update comes options that make more sense: * `looseTable` is no longer supported (it’s a bad GFM feature) * `spacedTable` is now called `tableCellPadding` * `paddedTable` is now called `tablePipeAlign` Closes GH-476. Related-to remarkjs/remark-lint#217. Reviewed-by: Junyoung Choi <[email protected]> Reviewed-by: Christian Murphy <[email protected]>
a) I’ve now added support to all the rules for checking the alignment rule
To:
But I don’t see that often. I guess people like using a ton of |
Subject of the feature
Support fixed-width columns like
| --- | --- |
regardless of cell content.Problem
I'm looking to match
remark-lint-table-cell-padding
with the followingremark
settings:The use case is tables with long cell content, for example in
standard
andLevel/awesome
. In these cases, the'padded'
option ofremark-lint-table-cell-padding
creates too much (git diff) noise. But the'compact'
option makes these big tables difficult to read.I propose to add a
'fixed'
option. Is that feasible?Expected behaviour
This should be valid:
Missing spaces or a length that isn't 3 should be invalid:
The text was updated successfully, but these errors were encountered: