- Use HTML tags to define the table to get the best layout result
- Use either backticks (```) or the HTML
preelement with attributelang - Keep a blank line before and after a code block for correct formatting and syntax highlighting
| Status | Response |
| 200 |
|
| 400 |
Error, what the hell is going on?!? |
| 500 | Internal Server Error |
| Before | After |
|
|
Some markdown editors show correct layout and syntax highlighting if you use <br> tags in your code block. But this is very cumbersome and akward. And finally GitHub itself will show the code block on a single line :(
| Status | Response |
|---|---|
| 200 | { |
| 400 | Error, what the hell is going on?!? |
You won't get syntax highlighting :(
| Status | Response |
| 200 |
{
"id": 10,
"username": "marcoeidinger",
"email": "[email protected]",
"created_at": "2021-02-097T20:45:26.433Z",
"updated_at": "2015-02-10T19:27:16.540Z"
}
|
| 400 |
Error, what the hell is going on?!? |
You just lost line breaks AND syntax highlighting :((
| Status | Response |
| 200 | ```json { "id": 10, "username": "marcoeidinger", "email": "[email protected]", "created_at": "2021-02-097T20:45:26.433Z", "updated_at": "2015-02-10T19:27:16.540Z" } ``` |
| 400 |
Error, what the hell is going on?!? |
Also check this out:
https://stackoverflow.com/a/77774604/8644294