What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

Possible Duplicate:
Is there any markdown to create tables?

I want to use a table in my answer.
e.g

|-------------|----------------|
| ShortCut | Description |
|-------------|----------------|

I have posted an answer here, which requires this kind of formatting.

Is it possible to have such formatting in stackoverflow Questions & answers ?

  • If yes, How ?
  • If no, why ?

Edit : I tried to use following code directly in editor of SO. But it didn't work for me.

<table>
<tr>
<td>hello</td>
<td>hello2</td>
</tr>
<tr>
<td>hello3</td>
<td>hello4</td>
</tr>
</table>
share|improve this question

marked as duplicate by Arjan, Al E., kiamlaluno, jonsca, Toon Krijthe Aug 5 '12 at 17:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
Your answer is here: webapps.stackexchange.com/questions/6700/… first answer links to a website that will do this for you. –  Won't Jul 1 '11 at 13:42

3 Answers 3

up vote 5 down vote accepted

Standard Markdown should have allowed in-lined HTML table. However, seems it's not supported by SE's implementation of Markdown.

There are currently few Markdown implementation, which do support tables syntax originally created for PHP Markdown Extra.

Tables in above syntax have source like this:

| Left align | Right align | Center align |
|:-----------|------------:|:------------:|
| This       |        This |     This     |
| column     |      column |    column    |
| will       |        will |     will     |
| be         |          be |      be      |
| left       |       right |    center    |
| aligned    |     aligned |   aligned    |

And are rendered as HTML table, which looks like this:

rendered table

Example table is from this Python implementation.

share|improve this answer

I fail to see why a table is needed for that answer.

But if you want to create a table, your best bet is to use the one you've posted in code tags:

|-------------|----------------|
| ShortCut    | Description    |
|-------------|----------------|

This could also be extended with Unicode.

It does not support extended formatting, though.

share|improve this answer
    
does <code> tag supports <kbd> tag within it ? –  Sagar R. Kothari Jul 1 '11 at 11:01
    
@sugar: No, I don't think so. –  Time Traveling Bobby Jul 1 '11 at 11:01
    
I posted the link to my answer just because I want to give some Idea of a case where Table is very necessary to demonstrate neat & sharp. –  Sagar R. Kothari Jul 1 '11 at 11:04
    
Note that the mobile theme uses wrapping, not scrolling. Makes ASCII tables look very bad. –  Arjan Aug 4 '12 at 12:29

You can use ASCII characters. For example:

                   [My DataTabel]                                     
  ┌───────────┬───────────┼───────────┬───────────┐
  │  Field#1  │  Field#2  │    ∙∙∙    │  Field#n  │
  ├───────────┼───────────┼───────────┼───────────┤
  │ Data[1-1] │ Data[1-2] │    ∙∙∙    │ Data[1-n] │
  ├───────────┼───────────┼───────────┼───────────┤
  │ Data[2-1] │ Data[2-2] │    ∙∙∙    │ Data[2-n] │
  ├───────────┼───────────┼───────────┼───────────┤
  │    ∙∙∙    │    ∙∙∙    │    ∙∙∙    │    ∙∙∙    │
  ├───────────┼───────────┼───────────┼───────────┤ 
  │ Data[m-1] │ Data[m-2] │    ∙∙∙    │ Data[m-n] │ 
  └───────────┴───────────┴───────────┴───────────┘ 
share|improve this answer

Not the answer you're looking for? Browse other questions tagged .