How to write Lists inside a Table in Markdown

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
3 min

banner

# Table of Contents

  1. How to write Lists inside a Table in Markdown
  2. How to write Lists inside a Table in Markdown using only HTML
  3. How to write Lists inside a Table in Markdown using newlines

# How to write Lists inside a Table in Markdown

You can use HTML to write lists inside a markdown table.

The ul or ol tags can be used to define an unordered or ordered list directly in your table.

README.md
| Name | Description | Another | | -------------------------------------- | ----------- | ------- | | bobby | hadz | com | | <ul><li>First</li><li>Second</li></ul> | Third | Fourth | | Fifth | Sixth | Seventh | | <ol><li>First</li><li>Second</li></ol> | Third | Fourth |

Here is how the output looks in a plain markdown editor.

list in table in plain markdown

And here is how the output looks in the GitHub markdown.

lists in table in github markdown

This approach also works in Jupyter Notebook markdown.

lists in table in jupyter notebook markdown

We used the ul (unordered list) element to insert a bulleted list in the table.

README.md
<ul><li>First</li><li>Second</li></ul>

You can nest two or more li (list item) elements inside the ul tag. Each list item appears on a separate line with a bullet.

You can use the ol (ordered list) tag if you need to insert a numbered list into the table.

README.md
<ol><li>First</li><li>Second</li></ol>

Each list item is displayed on a separate line with an integer that starts counting from 1.

# How to write Lists inside a Table in Markdown using only HTML

The example above mixes markdown and HTML.

If you'd rather only use HTML, use the following code sample.

README.md
<table> <tbody> <tr> <th>Name</th> <th align="center">Description</th> <th align="right">Another</th> </tr> <tr> <td>bobby</td> <td> hadz </td> <td align="center">com</td> </tr> <tr> <td> <ul> <li>First</li> <li>Second</li> </ul> </td> <td align="center">Third</td> <td align="right">Fourth</td> </tr> <tr> <td>Fifth</td> <td align="center">Sixth</td> <td align="right">Seventh</td> </tr> <tr> <td> <ol> <li>First</li> <li>Second</li> </ol> </td> <td align="center">Third</td> <td align="right">Fourth</td> </tr> </tbody> </table>

The HTML table above is equivalent to the markdown + HTML table from the previous subheading.

insert lists in markdown using only html

You can use the align attribute if you need to align the content in a table cell a certain way.

I've also written a detailed guide on how to right-align, justify-align and center text in Markdown.

However, the HTML syntax is quite verbose, so I prefer using markdown + HTML.

# How to write Lists inside a Table in Markdown using newlines

You can also use newlines to insert a list inside a table in markdown.

README.md
| Name | Description | Another | | ------------------------ | ----------- | ------- | | bobby | hadz | com | | First<br>Second<br>Third | Fourth | Fifth |

insert list in table using newlines

The example uses the br tag to insert a newline character between each list item.

Notice that the produced list doesn't have bullet points.

I've also written a detailed guide on how to add a new line in markdown.

If you also want to add bullets, you can use the &bull; character sequence.

README.md
| Name | Description | Another | | ----------------------------------------------- | ----------- | ------- | | bobby | hadz | com | | &bull; First<br> &bull; Second<br> &bull; Third | Fourth | Fifth |

add bullet points using character sequence

The same approach can be used to recreate an ordered list.

README.md
| Name | Description | Another | | ----------------------------------- | ----------- | ------- | | bobby | hadz | com | | 1. First<br> 2. Second<br> 3. Third | Fourth | Fifth |

add integers to create ordered list inside table

I've also written articles on:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.