Horizontal Rulers

A row of - (hyphen) or = (equals) characters may be added to a table to help visually separate groups of rows.

A common example is to clearly indicate that the first row is intended to be a header, and not part of the table's data.

| Animal | Color | Avg. Weight | | | --------- | ---------- | ----------- | ------ | | elephant | grey | 5_000 kg | skin | | giraffe | patchy | 1_000 kg | skin | | crocodile | grey | | scales | | lion | | 100 kg | fur | | leopard | camouflage | 50 kg | fur |
  • psv calls a row of horizontal lines a ruler
  • ruler's are not part of a table's data
    • rulers and lines of text which do not begin with a | (pipe) are treated as decoration
  • psv repeats the first - or = for whole row of a ruler.
    • i.e. mixing - and = within a single ruler is not possible
  • psv will stretch or shrink rulers to match the table's columns
  • psv will add or remove columns in a ruler as needed
  • psv only: rulers may be added anywhere in or around a table
  1. change the ruler above to a | === | === |… ruler (i.e. = instead of -) by adding just one character and then reformatting
  2. add a ruler between giraffe and crocodile by adding just 4 characters to the table

The Effect of Rulers on a Table's Data

Rulers are most often used as decoration, and as such are not included in a table's data.

Here is the same data again, but with some extra rulers to group rows and provide decorative features:

+-----------+-----------+------------+-------------+--------+ | Group | Animal | Color | Avg. Weight | | | ========= | ========= | ========== | =========== | ====== | | big | elephant | grey | 5_000 kg | skin | | | giraffe | patchy | 1_000 kg | skin | | --------- | --------- | ---------- | ----------- | ------ | | dangerous | crocodile | grey | | scales | | | lion | | 100 kg | fur | | | leopard | camouflage | 50 kg | fur | +-----------+-----------+------------+-------------+--------+

Properties of a Ruler

  • a ruler must begin with either a | (pipe) or + (plus) character
  • a ruler must contain at least one - (minus) or = (equals) character
  • a ruler may contain any amount of whitespace
  • a ruler must not contain any other characters.

Specifying a new Ruler

Rulers can be defined by just 4 characters:

  • the outer border (| or +)
  • an optional padding character (space)
  • a horizontal line character (- or =)
  • an optional column separator character (| or +)

The simplest way to add a ruler is to just add a row with the characters | - (pipe, space, hyphen) and then re-format your table, psv will fill in the rest.

Here is an example, each of the lines without any text will e interpreted as rulers.

+- | a | long | table | with | many | columns + = | blah | foo | - | bing | bong +-

Click and see what ps does.

The subtle difference between an empty row of data and a ruler.

Empty Rows
An empty row only contains | and whitespace characters.
Ruler
In order to differentiate a ruler from an empty row, your must include at least 1 horizontal line character (- or =)
This table has a ruler (because it starts with `|` and contains a `-`): | one | two | three |- But this table just has two rows of data (because the second row has no `-` or `=`) | one | two | three |