Tables in pure Markdown


#123

Or like this:

| Server | IP | Description |
|--------|----|-------------|
| cl1 
| 192.168.100.1
| This is my first server in the list
|
| cl2 
| 10.10.1.22
| This is another one server
|
| windows-5BSD567DSLOS
| 127.0.0.12
| This is customer windows vm. dont touch this! 
|
| DFHSDDFFUCKENLONGNAME
| 192.168.1.50
| Some printer
|
...

And this:

| Item | Amount | Cost |
|:-----|-------:|-----:|
| Orange
| 10
| 7.00
|
| Bread 
| 4
| 3.00
|
| Butter
| 1
| 5.00
|
| Total |      | 15.00 |

This solution gives you more space for creativity. Besides:

  • It’s no need global changes. (only one micro fix is needed)
  • It does not break anything.
  • Everyone will happy

This is the best solution, isn’t it?


#124

I agree with you that pipe tables aren’t very good for big tables. I still think they should be standardized; pipe tables are such a widely-supported Markdown extension that people expect them to work whether they’re in the spec or not.

On the other hand, I think you’re unfairly characterizing HTML tables. You don’t have to put in the end tags for rows or cells. This is fine (at least, it’s specified by HTML5 to work the way we want it to):

<table>
<tr>
<th> Server
<th> IP
<th> Description
<tr>
<td> cl1
<td> 192.168.100.1
<td> This is my first server in the list
<tr>
<td> cl2
<td> 10.10.1.22
<td> This is another one server
<tr>
<td> windows-5BSD567DSLOS
<td> 127.0.0.12
<td> This is customer windows vm. dont touch this!
<tr>
<td> DFHSDDFFUCKENLONGNAME
<td> 192.168.1.50
<td> Some printer
..
</table>

I guess that MediaWiki tables are better. I’m not convinced that they’re so much better that CommonMark should add them to the spec when they’re so rare among existing implementations.


#125

Yes, I see, html5 tables it’s quite simple, thanks for this. But I love markdown and I want to make it better to using with tables too.
I described the main problem to using markdown tables to you.

I don’t want fully mediawiki tables implementation in the markdown, but I want to have opportunity to make tables in vertically mode.

This solution, is fully solves this problem.
It is needed only simple check for newline symbol before pipe in the code.
So it will allow to use common markdown tables in vertically mode too.
Why not? It is not breaking anything, but may be very useful for all users.
And it is same yet markdown tables…


#126

I agree with your implementation.
But I would remove the alingment beneath the headers and put them into the headers themselves.

I think this is the best solution. and the most flexable. and people can have a grid table or a list style table Which is something I like


#127

I find it odd that no-one mentioned the necessity of row headers (i.e. ths to describe rows not columns). For some reason all the current Markdown flavours which support tables only support column headers. But it is really important for accessibility to support both!

Just consider the following table of pizzas and their cost:

				Small    Large
Salami			8.99     10.99
Hawaii			9.49     11.49
Margherita		7.99      9.99

For screen reader users to understand, e.g. the cell with “11.49”, they would need to have read out the pizza (row header = Hawaii) and the size (column header = Large). Just the one or the other is not enough to understand what the content of a cell means.

Most simple text markup languages allow a header cell anywhere in a table with a quite simple syntax, e.g.

  • Creole: |=
  • txt2tags: ||
  • DokuWiki: ^
  • Textile: |_.
  • I personally like: |# (because users already associate # with a heading in Markdown)

Colspans and rowspans are also important for accessibility. Wrongly empty cells can confuse screen readers. But unless they happen in header cells, they are not a big barrier.

Depending on length and complexity, not having header cells marked up correctly can make a table very difficult or impossible to understand for screen reader users.


#128

I agree that row headers are important, but marking them up may become clumsy – perhaps add a colon before the pipe:

|          | Small | Large |  
| -------- | ----- | ----- |  
|  Salami :|  8.99 | 10.99 |  
|  Hawaii :|  9.49 | 11.49 |  
|  Marge. :|  7.99 |  9.99 |  

Another observation I want to throw in here: Fallback rendering for pipe tables is improved in most implementations if each line is ended by a double space. The only exception is Blackfriday which does not render a table then.

## With double space

| Column Header | Second Column |  
| ------------- | ------------- |  
| data cell     | second cell   |  
| third cell    | fourth cell   |  

## Without double space

| Column Header | Second Column |
| ------------- | ------------- |
| data cell     | second cell   |
| third cell    | fourth cell   |

#129

Could the parser automatically figure out that it is a row header based on the empty cell in the top row?


#130

It could, but that’s not always the case. Too unreliable.


#131

John, given that it’s been 3½ years since you wrote that, and since in that time GitHub and many others have adopted CommonMark, should the core be settled without further delay?