Proposed table syntax (again)
Michel Fortin
michel.fortin at michelf.com
Fri Nov 19 16:57:29 EST 2004
I just had an idea.
The syntax I proposed back then when Shaun Inman started the discussion
on tables has one (fatal?) flaw.
First Name Last Name URL
-----------------------------------------------------------------
Jeffrey Zeldman <http://www.zeldman.com/>
John Gruber <http://www.daringfireball.net/>
Joshua Davis <http://www.joshuadavis.com/>
Title Description
===============================================================
Long lines This is a multiple line cell because
the content cannot enter on one line
only.
---------------------------------------------------------------
No subject. No need for a description.
---------------------------------------------------------------
If you find these tables nice, it's because you look at them with a
fixed-width font. The result is really awful using a proportional font.
This may not be so bad for tables in Markdown as long as you edit the
text using a fixed-width font. The problem is that many (most?)
weblog/website editors do use proportional font as the default
(MovableType?). So, while it's good-looking with fixed-width, many
users will have a hard time making tables with this syntax.
Here is a table aligned using spaces with the Helvetica font on a Mac:
First Name Last Name URL
------------------------------------------------------------------------
---------
Jeffrey Zeldman <http://www.zeldman.com/>
John Gruber <http://www.daringfireball.net/>
Joshua Davis <http://www.joshuadavis.com/>
It doesn't look good with a fixed-width font, and is also mostly
impossible to work with this syntax from a programming point of view.
Some people argue that the table needed to be separated with `|` pipes.
I think this is the only way to do it right if we want to work with
proportional fonts. But pipes add clutter so they must be used
carefully.
* * *
So here is my new proposed syntax:
First Name | Last Name | URL
-----------------------------------------------------------------
Jeffrey | Zeldman | <http://www.zeldman.com/>
John | Gruber | <http://www.daringfireball.net/>
Joshua | Davis | <http://www.joshuadavis.com/>
Title | Description
===============================================================
Long lines | This is a multiple line cell because
| the content cannot enter on one line
| only.
---------------------------------------------------------------
No subject. | No need for a description.
This syntax works well in a proportional-font web editor, but it still
manage to stay low on clutter. It is also better for backward
compatibility because headers rarely contain pipes in them, and I
suspect headers with a pipe followed by a paragraph with a pipe in it
would be really hard to find.
Also, many people want to be able to make header cells on the left
side. I would allow them to exist by making the first column separator
double pipes. This is what it looks like (with and without top
headers):
|| Solution A | Solution B | Solution C
-------------------------------------------------------------
Name || Go away | Go there | Go back
Price || $242 | $484 | Priceless
------------------------------------------
Size || Small | Medium | Large
Price || $2.42 | $4.84 | $10.12
This would also work with the multiple-line-per-cell table syntax, like
this:
=========================================================
Protocol || TCP/IP | AppleTalk
---------------------------------------------------------
Use || The Internet; | Local networks,
|| local networks. | (work only between
|| | Macintosh computers)
---------------------------------------------------------
Company || Many. | Apple Computer inc.
One drawback of this syntax is that it is not possible to make a table
with only one column.
Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/
More information about the Markdown-discuss
mailing list