4

Can someone please share a meaningful link on how to create a table for a Stack Overflow question?

Most times when I have a question, I would just type it out as an example (because the real question is a complicated production thing), but they are always mangled.

So I'm using this link:

How to make tables in good format in asking questions here (which is understandable by others)?

which says to highlight the text and click on the {} from the menu. It's readable but not quite lined up:

 col1  col2  col3
 1  apple  red
 2  grape  green
 3  watermelon  pink

I see this post

How to create table in SO Question

which suggests using this tool:

https://senseful.github.io/text-table/

But that looks like a mess:

+-----------------------------------+------------+--------+ | Col1 | Col2 | NumCol | +-----------------------------------+------------+--------+ | Value 1 | Value 2 | 123 | | This is a row with only one cell | | | | This row is testing html entities | Te
st | 45 | +-----------------------------------+------------+--------+

So, is there something else I'm missing which works to create tables in this forum?

0

1 Answer 1

4

There is no table formatting as such on Stack Overflow. The other post just mentions a workaround using code blocks, you still need to highlight the text and click on the {} from the menu. Therefore, what you are missing is the 4 spaces in front of the table, needed for code formatting. When you add them you'll get a clear table.

+-----------------------------------+------------+--------+
|               Col1                |    Col2    | NumCol |
+-----------------------------------+------------+--------+
| Value 1                           | Value 2    |    123 |
| This is a row with only one cell  |            |        |
| This row is testing html entities | Te<br />st |     45 |
+-----------------------------------+------------+--------+

You can paste the contents into the answer space, highlight the table and click Ctrl+k. That will format the table as code, and your table

2

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