code block inside table row in Markdown

The github markdown doc states that you can include inline/span markdown tags within table cells. This is the same for most flavours of markdown other than a few which have been trying to establish more control over table layouts.

You could get close with inline code elements, but that will not format with syntax colouring, or line indents.

| Status | Response  |
| ------ | --------- |
| 200    | `json`                          |
|        | `   {`                          |
|        | ` "id": 10,`                    |
|        | ` "username": "alanpartridge",` |
|        | ` more code...`                 |
|        | `}`                             |
| 400    |                                 |

Alternatively, create your table the old-fashioned way with html, which gives you rowspan for greater layout control.

Leave a Comment

tech