Markdown Toolbox Logo Markdown Toolbox
Home
Blog

Project Hail Mary Project Hail Mary by Andy Weir

Project Hail Mary. One of my favorite science fiction books. I also liked The Martian. I recommend checking it out, either written or audio.

Affiliate Link - As an Amazon Associate I earn from qualifying purchases.

How do I Make a Table Multiline in Markdown?

Thursday, December 14, 2023

In Markdown, creating multiline cells within a table can be a bit tricky as standard Markdown tables don't directly support multiline text. However, you can use a few workarounds to achieve this effect.

One common method is to use HTML <br> tags within your table cells to create line breaks.

Here's an example:

| Header 1         | Header 2         |
| ---------------- | ---------------- |
| Line 1<br>Line 2 | Text in column 2 |

This will render as a table where 'Line 1' and 'Line 2' are on separate lines within the same cell:

Header 1Header 2
Line 1
Line 2
Text in column 2

Another approach is to use manual spacing or alignment, although this can be less reliable as it depends on the specific renderer being used.

Note that using HTML within Markdown tables may not be supported by all Markdown renderers, so it's important to test this in your specific environment.