Any news re tables and Markdown?

Michel Fortin michel.fortin at michelf.com
Mon Mar 14 21:59:16 EST 2005


Le 14 mars 2005, à 18:07, John Gruber a écrit :

>     This   That
>     >>>>   <<<<
>       12   12
>      123   123
>        1   1
>
> And even then things aren't going to line up visually.

This is why I support the idea of the *optional* pipes. If you write 
your table using pipes as column separator, then Markdown use that to 
separate columns so you can align cells using the font you want. It 
looks like that (A):

     |  Right  |  Left  |  Center  |  Default  |
     |-------  |  ------|----------|  -------  |
     |     12  |  12    |   12     |      12   |
     |    123  |  123   |   123    |     123   |
     |      1  |  1     |    1     |       1   |

But since pipes are *optionals*, you can also write it like that (B):

     |  Right   Left    Center    Default |
     | ------   -----  --------   ------- |
     |     12   12       12           12  |
     |    123   123      123         123  |
     |      1   1         1            1  |

Or like that (C):

     |  Right   Left    Center    Default
     | ------   -----  --------   -------
     |     12   12       12           12
     |    123   123      123         123
     |      1   1         1            1

Or like that (D):

      Right   Left    Center    Default
     ------   -----  --------   -------
         12   12       12          12
        123   123      123        123
          1   1         1           1

Now, let's compare each option:

|  Table syntax   Column separator  Font choice  Single-column  Comment 
                |
| --------------  ----------------  -----------  -------------  ------- 
                |
|       A         Pipe (`|`)        Any font     Yes            
Somewhat cluttered.    |
|       B         Character count   Monospace    Yes            
Currently my favorite. |
|       C         Character count   Monospace    Yes            Lazier 
than B.         |
|       D         Character count   Monospace    No             
Single-column table?   |

I feel supporting A, B and C would be a good move. A because it works 
anywhere, and because some people like pipe separators. B because it 
looks clean and uncluttered, and C because it's just like B but a 
little lazier, and Markdown always allow laziness where it can.

* * *

In case you didn't notice, the last table I wrote was quite large (88 
characters). In fact, I had to expand my email window to write it. This 
is exactly this kind of table that leads me to defend a multiple-line 
per row variant. Like this one:

|  Table    Column                  Single-                      |
|  syntax   separator  Font choice  column   Comment             |
| ========  =========  ===========  =======  =======             |
|    A      Pipe       Any font     Yes      Somewhat cluttered  |
|           (`|`)                            but always work.    |
| --------  ---------  -----------  -------  ------------------  |
|    B      Character  Monospace    Yes      Currently my        |
|           count                            favorite.           |
| --------  ---------  -----------  -------  ------------------  |
|    C      Character  Monospace    Yes      Lazier than B and   |
|           count                            less pretty.        |
| --------  ---------  -----------  -------  ------------------  |
|    D      Character  Monospace    No       No single-column    |
|           count                            table and may be a  |
|                                            little confusing    |
|                                            with header syntax. |

Isn't this more readable? Beside, now I can write the complete comment 
I wanted to write. I think this is important for people who are going 
to write tables that contains a little more than numerical data.

* * *

 From the first code sample of this email:

     |  Right  |  Left  |  Center  |  Default  |
     |-------  |  ------|----------|  -------  |

Noticed how I made possible text alignment in a 
proportional-font-compatible way? Instead of counting dashes and 
comparing with header, it checks for the presence of one or more spaces 
between the header's dashes and the pipes. Space(s) on the right: 
right-aligned; space(s) on the left: left-aligned; no space: 
center-aligned; spaces on both side: default style sheet alignement. 
Now proportional font users can align text in their cells too!


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



More information about the Markdown-Discuss mailing list