Have two columns in Markdown

While this doesn’t work for all dialects of Markdown, I got this to work with GitLab, GitHub, and mdBook.

Basically, you create the table via HTML. Markdown and HTML don’t mix well, but if you surround the Markdown with whitespace, sometimes the Markdown can be recognized.

https://docs.gitlab.com/ee/user/markdown.html#inline-html

<table>
<tr>
<th> Good </th>
<th> Bad </th>
</tr>
<tr>
<td>

```c++
int foo() {
    int result = 4;
    return result;
}
```

</td>
<td>

```c++
int foo() { 
    int x = 4;
    return x;
}
```

</td>
</tr>
</table>

Leave a Comment