Tables

Michel Fortin michel.fortin at michelf.com
Mon Nov 7 20:49:41 EST 2005


Le 2005-11-07 à 19:31, robert mcgonegal a écrit :


> Historical Analysis

> -----------------------------

> Widget % Price

> =====================

> Windows Vista 87% $12.99

> -----------------------------

> Mac OS X 10.4.3 12% $87.50

> ----------------------------

> Linux 8% $14.34

> ----------------------------


You say this looks like a table, but for me, with a monospaced font,
it hardly look like it. (What font did you use?)

But this issue aside, it looks pretty much like the first tables I've
implemented in my [October 2004 experimental PHP Markdown][1]. In the
same month there was much discussion about many tables syntax if you
want to take a look. In short, the problems with this syntax are:

1. It can be mistaken for headers (current Markdown treat these
as such).

2. You either require the user to have a monospaced font to for
writing tables by aligning columns properly, or you say that
two or more spaces are needed between each column, which can
easily lead to accidents.

Following more discussion in [March 2005][2], I released a special
version of [PHP Markdown called Extra][3] which can do tables. (If
course, you'll need PHP instead of Perl.) It uses pipes as a column
separator and can do per-column alignement. Your table would look
like this.

Widget | % | Price
---------------- | -----:| -------:
Windows Vista | 87% | $12.99
Mac OS X 10.4.3 | 12% | $87.50
Linux | 8% | $14.34

... with second and third columns right-aligned. The only thing
missing is the caption. I would like to have a way to add a caption
to the table, but I never figured out what syntax could express that.
Any idea?


[1]: http://six.pairlist.net/pipermail/markdown-discuss/2004-
October/000753.html
[2]: http://six.pairlist.net/pipermail/markdown-discuss/2005-March/
thread.html
[3]: http://www.michelf.com/projects/php-markdown/extra/

- - -

Note to John Gruber: wouldn't it be great to have a little search box
for the archives somewhere? Fortunately I have almost all the archive
in one mailbox for easy searching, but this won't be the case for
newcomers.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/




More information about the Markdown-Discuss mailing list