Left-align headers in Markdown table?

Viewed 31964

Using the table example from "Markdown Cheatsheet" on GitHub, you get this:

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

enter image description here

My question is, is there any way to left-align the header cells while retaining the alignment in the image? IE, I want to align the header differently than the body.

3 Answers

Markdown:

| Tables        | Are           | Cool  |
|:------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| col 1 is      | left-aligned  |   $42 |
| zebra stripes | are neat      |    $1 |

Result:

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
col 1 is left-aligned $42
zebra stripes are neat $1

Note that the colon (":") on the second row, and the second character is what worked to The other option is to move the numbers to the left-most column (as below)

Amount | Items
------:|:-----
    20 | Wooden Boards
     5 | Old Parts

Try it on StackEdit.

It does not seem to work putting the ---- line above the headers.

On the second line, I would change to this to align everything (headers and content) to the left:

| :------------ | :-------------- | :----- |

Notice the colons on the left of each column.

Related