On simplifying table syntax in any future markdown extension. (Use CSV)

mofo syne mofosyne at gmail.com
Fri Sep 5 05:28:23 EDT 2014


Tables are used very often to help explain information that would
requires multiple paragraphs into a clear concise 2d layout. The issue
with making this feature optional means it won't be fully widespread.
And stuff like tables and anchors are common enough to be a core
standard.

A common complaint I understand about tables in markdown variants that
attempts to implement this, is that it is hard to maintain. So here is
some ways I think it can be simplified from "Markdown Extra" syntax
for this effort.

This is Markdown Extra Syntax for tables:

 | Item      | Value |
 | --------- | -----:|
 | Computer  | $1600 |
 | Phone     |   $12 |

First example (Compress the pipe headers):

To indicate a field is a header you use |-, -| .
For header alignment: |:- left aligned -|, |- right aligned -:| |:-
Centre aligned -:| .

|:- Header -:|:- Header -:|
|   Row      |   Row      |
|   Row      |   Row      |

Second Example ( CSV Input):

The second issue, is that people find it hard to have to deal with
formatting the pipes. If alignment of cell data is of no concern to
the user, then we should use CSV data as the inspiration.

I'm a big fan of CSV data, due to how easy it is to type. The ease of
use comes from sticking to csv which most people use already, and
combining it with a simplified table header.

If you still need alignment control for each cell, then you can just
use the previous (but simplified) pipe tables shown above using |:, :|

|:- Year -|:- Make  -|:- Model                         -:|
  1997,      Ford,      E350
  1999,      Chevy,    "Venture ""Extended Edition"""
  1999,      Chevy,    "Venture ""Extended Edition"""
  1996,      Jeep,      Grand Cherokee

 This is some other text, since the end of a table is implied by a new
paragraph.

example data from: http://en.wikipedia.org/wiki/Comma-separated_values

Essentially, just treat pipes as 'optional' for the actual cell data
(which is the field that gets modified most often anyway (compared to
the header). This way, we can avoid too much formatting, and heck if
you are lazy, you could just remove whitespaces and it shall still be
very maintainable like so:

|:- Year -|:- Make -|:- Model  -:|
1997, Ford, E350
1999, Chevy, "Venture ""Extended Edition"" "
1999, Chevy, "Venture ""Extended Edition"" "
1996, Jeep, Grand Cherokee

The second approach is my preference. Since I believe markdown is
about getting formatting out of the way of your writing.


More information about the Markdown-Discuss mailing list