Tag: markdown

Markdown: how do I add a newline in a table?

When creating tables in markdown, you use the vertical line | to split the columns. Each line of the document represents a row of the table. So adding a normal line break will result in a new row by default. Let’s assume you have a table with a large text and you want to split this text only in a single cell to improve readability. When using this markdown:

| Date | Action | Query |
| ---- | ------ | ----- |
| 2022-04-28 | none | search |
| 2022-04-25 | /url/to/my/page, added details about this topic, improved description | new |

This will create the following output:

To add a line break inside a table cell, you can simply use a html line break <br> . This is also suggested for line breaks in simple text outside tables. So the same contents with a line break:

| Date | Action | Query |
| ---- | ------ | ----- |
| 2022-04-28 | none | search |
| 2022-04-25 | /url/to/my/page<br> added details about this topic, improved description | new |

Will result in the following output:

And there you have it: a table with a line break inside a cell.