Profiles: Compatibility with Similar Formats
psv is not the only plaintext table format in our world.
A profile is a named collection of rules that psv uses to generate tables for other PSV-like environments.
By default, psv uses the psv profile, which utilises all of psv's capabilities.
Markdown, however, requires that certain conditions are met before it will recognise a table. To ensure that psv fulfills markdown's requirements, you can use the markdown profile , e.g. via the command psv markdown
psv has no effect on a markdown table's rendering as HTML, PDF etc., with the exception of providing left, right or centered alignment hints. psv is can only clean up the original plaintext version of a markdown table.
Try reformatting the table below with each of the different profiles. Take note of the subtle differences in the appearance of the table after it is re-formatted with each profile.
psv always uses the hints provided by a table.
When the above example changes from psv profile to markdown profile, you should notice:
- the rows are sorted (even though markdown has no support for sorting)
- and the numbers are decimal aligned (even though markdown does not support numeric alignment)
- reformatting a table which was created with the markdown profile will cause the number column to become right-aligned and no additional sorting will be performed!
- the animated demo in the above table attempts to show this effect
This may appear to be inconsistent behaviour at first glance. However, this is exactly how psv was deigned to work!
You can adjust a table's rulers, or use psv's commands to adjust a table into the desired form, and then use a profile once at the end to ensure that the the table is compatible for its intended purpose.
Default Profile
The default profile, psv, enables all psv features without restriction.
- rulers may be used anywhere
- rulers may contain alignment and sorting hints
- escape sequences for pipes, tabs and newlines are supported
- sorting applies to all rows between rulers - a ruler after the first row will keep the header in place
Markdown Tables
The markdown Profile Definition
- all of a table's rows and the ruler must have the same number of columns
- tables must have exactly one horizontal ruler
- the ruler must be the second line of the table
- each field of the ruler must have at least three consecutive - or = characters
- the patterns :---, ---: or :---: may be used in a ruler to specify left-, right- or center alignment respectively
- no support for numerical data or version numbers
- the first row is never sorted due to the ruler on the second line
Gherkin Data Tables
The gherkin profile, named after the gherkin language, used for defining Behaviour Driven Development scenarios.
Profile Definition
- tables must not have any rulers
- the first row is never sorted - assumed to be the column name header
Other Formats
Other formats, such as HTML or other markup languages, are not within psv's scope.