Proposed table syntax

John Gruber gruber at fedora.net
Thu Oct 21 13:23:14 EDT 2004


I'll try to catch up with one message. It's a good topic for
discussion.


Shaun Inman <markdown at shauninman.com> wrote on 10/20/04 at 9:23am:

>   Label One......:    Some data
>   Label Two......:    Additional data
>   Label Three....:    More data

This style doesn't appeal to me.


> Then there's a table with table heads across the top row:
> 
>   First Name      Last Name       URL
>   ==============================================================
>   Jeffrey         Zeldman         http://www.zeldman.com/
>   John            Gruber          http://www.daringfireball.net/
>   Joshua          Davis           http://www.joshuadavis.com/

Something like this, I've been thinking about. I do think some sort
of table support could fit in very well with Markdown's existing
syntax and style, and I think it could be useful. The problem is
that HTML tables can be extraordinarily complicated; the challenge
will be do devise a syntax for Markdown that remains as simple as
possible but still useful for most purposes.

I wonder if it'd be unwise to use `=` signs as the header delimiter,
since they're already used for headers. More on this later.


* * *

Michel Fortin <michel.fortin at michelf.com> wrote on 10/20/04 at 1:24pm:

> First, sometime I prefer to fit my text in a table on more than one 
> line. A row separator could be useful in that case:
> 
>   Company                 Description
>   ===========================================================
>   Apple Computer inc.     The maker of the Macintosh, iPod,
>                           Quicktime and Firewire.
>   -----------------------------------------------------------
>   Microsoft               No need for a description.
>   -----------------------------------------------------------
>                           Multiple paragraphs?
> 
>                           *   And lists?
> 
>                               And why not code blocks.
> 
>                           > Noticed the empty cell beside
>                           > this one?
>   -----------------------------------------------------------

This pushes the line out a bit. I'd have to think about this. How
frequently do people really need multiple paragraphs and lists and
blockquotes inside a table? (Not counting someone using tables for
page layout, of course, which isn't applicable to Markdown at all.)

It's not that I don't think this is a nice idea. And it looks
Markdown-y. I just don't want to add support for these features if
they're only going to be used seldomly.


* * *

Jelks Cabaniss <jelks at jelks.nu> wrote on 10/20/04 at 2:20pm:

> Precedents exist.  See for example [reStructuredText]'s, [Grutatext]'s and
> [TexTile]'s implementations.
> 
> [reStructuredText]: http://tinyurl.com/5s7mk#tables
> [Grutatext]: http://www.triptico.com/download/README_grutatxt
> [TexTile]: http://www.textpattern.com/help/?item=table
> 
> Personally, I prefer the first two -- which are quite similar.

My problem with Grutatext- and reST-style tables is that they're too
complicated. There's no way Markdown should support things like
rowspans and colspans. For that sort of thing, it's better and
easier to just write raw HTML.

I think all the `|` pipes end up getting noisy, visually. I think
the reason they use them is to allow for the column and row spanning
-- that sort of thing would be difficult or maybe even impossible to
parse if you were just using spaces and tabs to separate table cells.

The same goes for Textile's syntax, with regard to the pipes.

reST's "simple" table style is a little closer to what might work
for Markdown.


* * *

Angie Ahl <alists at vertebrate.co.uk> wrote on 10/20/04 at 7:45pm:

> regex wise I'd say a cell separator (</td><td>) should be one or more 
> tabs and possibly, more than 1 space( but I can see problems with that.

Requiring tabs would indeed make it easier to parse -- as you point
out, using "more than 1 space" would make it easy to add a cell
break by mistake. However, as Lou Quillio pointed out, tabs are
problematic for anyone typing in a web browser textarea field.

That said, Markdown is not optimized for people writing in textarea
editors. It's optimized for people writing in decent text editors.
But, if I had to guess, I'd wager that textarea fields are the most
popular place where Markdown is used.

So if we separate cells with whitespace, I think it'll have to work
with both spaces and tabs. Maybe three-or-more spaces, instead of
two-or-more?


> Doing it with 1 or more tabs leads to a problem if there were empty 
> cells, you'd need to mark a cell as empty, maybe with something like 
> [empty]

Empty cells are a big problem if we want to use whitespace to
separate cells. (This is another reason why reSt, Grutatext, and
Textile use `|`s, I'll bet.)


-J.G.


More information about the Markdown-discuss mailing list