[kramdown-users] RFC: Table syntax proposal, try 2

Shawn Van Ittersum svicalifornia at gmail.com
Thu Dec 31 07:37:57 EST 2009


On Thu, 31 Dec 2009 05:36:47 -0500, Eric Sunshine wrote:
> On 12/31/2009 3:25 AM, Thomas Leitner wrote:
>> * A *header separator line* is started with a pipe character -- which
>>    starts the first column --, optionally indented up to three spaces,
>>    followed by one or more optional spaces/tabs and an optional colon,
>>    followed by one or more dashes and finally an optional colon and
>>    another set of one or more optional spaces/tabs. Each other column
>>    also starts with a pipe character and follows the same syntax as the
>>    first column. The colons are used for aligning the content of each
>>    column, as explained below.
> 
> This description is still difficult to follow. One way to simplify it 
> dramatically would be to describe normal separator lines first, and 
> then describe header separators as: "A header separator line is like 
> a normal separator line, except..." and then describe the colons.

I agree.  It would actually be much simpler to drop the definition for "header separator line."  Then subsequently:

* Define "content line" to be a line starting with pipe that is not a separator line.
* Specify that all content lines appearing above the first separator line will be rendered as table header cells
* Explain how the first separator line may specify alignment of each table column by use of colons.

It would be interesting if kramdown allowed colons in all separator lines, to change column alignment for subsequent content lines of the table:

| header    | row    |
|-----------|:------:|
| feature 1 | Yes!   |
| feature 2 | Yes!   |
| feature 3 | Yes!   |
|-----------|-------:|
| Plan 1    | 3.99   |
| Plan 2    | 5.99   |
| Plan 3    | 9.99   |
|-----------|--------|

In the above example, the second column would change from center alignment in the first body to right alignment in the second body.

Shawn


More information about the kramdown-users mailing list