Column Justification Hints

psv can also justify data within a table's columns.

To do this, psv allows the addition of a very limited set of characters to each field of a ruler, indicating how the data in each column should be laid out.

| left (:-) | center (-:-) | right (-:) | number (.) | version (..) | :- | -:- | -: | . | .. | short | short | short | 3.14159... | 0.0.1-alpha | mini | mini | mini | -2.8e3±1.6 | v1.2 | extra long | extra long | extra long | 299792458 | v26.2.1

Rulers can also be used to specify the horizontal justification of the text in each column.

When psv reads a table, it will automatically preserve any justification hints and re-use them if needed when re-formatting the table.

psv only puts justification hints in the first ruler under the header row, but it will accept hints from any ruler within a table!

psv will always collect all justifcation hints in the first ruler that appears after the first row of data.

Available Justification Hints

Pattern Description Notes
: Justify to the column's left side (default) only valid when : is the first non-whitespace character in a column
-: Justify to the column's right side
-:- Justify to the column's center not available in markdown
:-: Center a column (markdown style)
. Justify Numerically (on decimal point) not available in markdown
.. Justify on Major Version Number not available in markdown
  • the 3-character short-cuts used here can be any length
  • try changing the width of the center column, does the position of the : have any effect?
Numbers can be aligned to their decimal point by adding a '.' character... | constant | number | -:- | -.- | pi | ~3.1415 | e | ~2.8 | c | 299792458 m/s Version numbers can also be aligned, using '..' in a column's ruler... | release name | version | -:- | -..- | flying-fish | 0.0.1-alpha | bunny | v1.2 | battle-bunny | v1.2.1
  • what happens if you replace the .. hint with just a single .?