Skip to content

Instantly share code, notes, and snippets.

@mokagio
Last active August 31, 2023 00:14
Show Gist options
  • Save mokagio/2dc7c31faf624385210afa2cda3a2ee1 to your computer and use it in GitHub Desktop.
Save mokagio/2dc7c31faf624385210afa2cda3a2ee1 to your computer and use it in GitHub Desktop.
How to do tables in GitHub flavoured Markdown

This:

heading 1 | heading 2 | heading 3
--- | --- | ---
abc | bcd | cde
def | efg | fgh

becomes this:

heading 1 heading 2 heading 3
abc bcd cde
def efg fgh

You can also use plain old HTML tables. This:

<table>
  <tr>
    <th>heading 1</th>
    <th>heading 2</th>
    <th>heading 3</th>
  </tr>
  <tr>
    <td>abc</td>
    <td>bcd</td>
    <td>cde</td>
  </tr>
  <tr>
    <td>def</td>
    <td>efg</td>
    <td>fgh</td>
  </tr>
</table>

becomes this:

heading 1 heading 2 heading 3
abc bcd cde
def efg fgh

Using HTML is handy because you can do more advanced things like nested tables, or adding lists within cells.

@rahaaatul
Copy link

How do you do table inside a table in markdown?

@AW-Chino
Copy link

AW-Chino commented Aug 31, 2023

heading 1 heading 2 heading 3
abc bcd cde
heading 1 heading 2 heading 3
abc bcd cde
def efg fgh
| efg | fgh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment