You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minimum of length 3 to replace both the leading and trailing hyphen with colons : for center-alignment (ie. :-:, the shortest possible center-aligned delimiter),
and I didn't want to deal with the edge case where the column only has a width of 1 character, like:
| a |
| - |
| b |
The improvement
Add 1-space paddings on the edge of the hyphens.
As for the edge case where the column has < 3 characters, we can either:
set the minimum width of columns to 3 characters (excluding the 2-space paddings):
| 1 | | 12 | | 123 | | 1234 |
| --- | -> | --- | -> | --- | -> | ---- |
| a | | a | | a | | a |
Center-aligned:
| 1 | | 12 | | 123 | | 1234 |
| :-: | -> | :-: | -> | :-: | -> | :--: |
| a | | a | | a | | a |
extend the hyphens all the way if there's < 3 characters, else pad the hyphens:
| 1 | | 12 | | 123 | | 1234 |
|---| -> |----| -> | --- | -> | ---- |
| a | | a | | a | | a |
Center-aligned:
| 1 | | 12 | | 123 | | 1234 |
|:-:| -> |:--:| -> | :-: | -> | :--: |
| a | | a | | a | | a |
The question
Which of the 2 styles in "The improvement" section above is better?
The text was updated successfully, but these errors were encountered:
Context
Currently, the hyphens
-
of the table delimiter-row extends all the way to the column-separators|
:and does not pad the hyphens with a space like:
This was because tables require:
minimum of 3 hyphens
(although GitHub doesn't require it, and technically accepts 1 hyphen)
minimum of length 3 to replace both the leading and trailing hyphen with colons
:
for center-alignment(ie.
:-:
, the shortest possible center-aligned delimiter),and I didn't want to deal with the edge case where the column only has a width of 1 character, like:
The improvement
Add 1-space paddings on the edge of the hyphens.
As for the edge case where the column has < 3 characters, we can either:
set the minimum width of columns to 3 characters (excluding the 2-space paddings):
extend the hyphens all the way if there's < 3 characters, else pad the hyphens:
The question
Which of the 2 styles in "The improvement" section above is better?
The text was updated successfully, but these errors were encountered: