Proposed table syntax

John Gruber gruber at fedora.net
Thu Oct 21 20:57:48 EDT 2004


Shaun Inman <markdown at shauninman.com> wrote on 10/21/04 at 3:51pm:

> What I find odd is that there's been no resistance to suggesting
> that the table be tabbed in once given the conflict with code
> blocks--maybe the indentation was just misinterpreted as a sample
> code block?

That's definitely what I thought you were doing -- using the
indentation as a Markdown-style code block to show your proposed
syntax.

Indenting tables with whitespace is a definite no-go. How would you
include an example table showing how to write a table using Markdown
syntax? One of the things that's really nice about Markdown, at
least from my perspective, is that it's easy to write the syntax
documentation using Markdown syntax, which turn serves as a great
way for people to a get a feel for it.

Whitespace indentation = code block, and nothing else. That's an
easy rule to remember.


> Despite the conflict I think there should to be something that indents 
> the table from the rest of the copy. How about a vertical pipe followed 
> by at least one whitespace character:
> 
>   | Company                   Description
>   | ===========================================================
>   | Apple Computer inc.       The maker of the Macintosh, iPod,
>   |                       Quicktime and Firewire.
>   | -----------------------------------------------------------
>   | Microsoft             No need for a description.
>   |                       More lines here
> 
> That would also allow for the reuse of the `=` and `-` for `<thead>` 
> and `<tr>` delimiters respectively.

I don't know if it's necessary. If it is, `|` is probably a decent
character to use. But I don't know that it needs to be prefixed with
anything.

Do you think it's necessary for the purposes of visually setting
tables apart within the flow of the document? I think they'd stand
apart naturally.

If you're worried about setting them apart to make it easier for the
software to parse -- don't. It's better to devise good clean syntax,
then just figure out a way to parse it.

Maybe we should use a different character to underline the header.
`~` and `:` are available:

    Browser     Share
    :::::::::::::::::
    Safari      50
    IE/Win      40


    Browser     Share
    ~~~~~~~~~~~~~~~~~
    Safari      50
    IE/Win      40


    Browser     Share
    #################
    Safari      50
    IE/Win      40


    Browser     Share
    ^^^^^^^^^^^^^^^^^
    Safari      50
    IE/Win      40


I can't say any of those really appeal to me, though.

* * *

Here's an interesting example. In this post:

<http://daringfireball.net/2003/01/lies_damn_lies>

which was written a year before Markdown existed, I was too lazy to
make a real HTML table, and instead published a table formatted in
plain text using a <pre> block.

Here's a snippet:

    Browser        Platform     Unique Visitors
    -----------    ----------   ---------------
    Safari         Mac OS X           713
    Safari v51                        186
    
    IE 5.x         Mac (all)          318
    
    IE 6.0         Windows            597
    IE 5.x         Windows            245


This isn't a proposal for Markdown; just an example.

-J.G.


More information about the Markdown-discuss mailing list