Basic Tables

I’ve covered tables in the past, but with the new little live editor it’s worth taking a second swing for the Almanac.

Many brews will use tables for things like class tables, roll tables, lists of loot, monster stat blocks and more. All of these tables can have different layouts and don’t necessarily just follow regular columns and rows– they can include cells that span either columns or rows, or both.

This post will cover just the basic tables and the Markdown syntax for them, and then the extended Homebrewery-specific syntax will be covered in a later post. Yet another post will cover some common styling tips.

Syntax

Let’s start with just the most basic table:

Markdown does a lot of work in taking what is a very verbose set of HTML tags and abbreviating it down to a simple visual syntax of dashes - and pipes |. The pipes do not need to line up exactly, though you should have the same number of pipes in each row. The second row, with the dashes, sets the header.

Note the structure of the table at this point, it will be good to understand it particularly when you go to start thinking about CSS selectors for styling it. The tag hierarchy looks like:

- table
  - thead
    - tr
      - th
  - tbody
    - tr
      - td

Alignment

The only remaining item to cover for basic Markdown syntax is the ability to set the text alignment in columns with :. In the header/body separator, the second row with the dashes, you can place colons at the beginning, end or both ends of the dashes to set the alignment. |:---| for left, |---:| for right, and |:---:| for centered. This will apply to the whole column. This is applied directly on the element as an align=[...] attribute, but is overridden by any CSS that targets that column with a different alignment.

Resources