Redcarpet table extensions

Software

Here’s something cool I didn’t realise. With the table extension in the redcarpet markdown parser, you can write tables thusly:

| Header1 | Header2 | Header3 |
|---------|---------|---------|
| Cell1   | Cell2   | Cell3   |
| Cell34  | Cell5   | Cell6   |

When interpreted, the table is translated into the one below, complete with proper <th>, <thead> and <tbody> tags. I’ve noticed even people hardcoding HTML don’t usually bother doing this!

Header1 Header2 Header3
Cell1 Cell2 Cell3
Cell4 Cell5 Cell6

You can enable it in your Jekyll config script as below, making sure NOT to use tabs!

markdown: redcarpet
redcarpet:
    extensions: ['tables']

It’s a nice idea, and certainly great for quick mockups. Given Markdown doesn’t let you define inline styles though (important for web feeds), I’ll probably stick to generating them manually.

Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!