Skip to main content

Tables

Tables that fit, and scroll sideways when they don’t

Tables get borders and keep their alignment. When a table is wider than the text, tomes shrinks its widest columns and wraps their cells; when that’s not enough, the table keeps its natural width and scrolls sideways with zh and zl (an arrow shows there’s more). Enter on a table shows it full screen, and yt copies it as tab-separated values.

tomes
tomes "$TOMES_DOCS_ROOT/tests/fixtures/quarto-book/_book" -c tables
tomes
 Fixture Book                    │                                                                           ┃
 Preface                         │ 1  Tables                                                                 ┃
 Part One                        │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  ┃
▸1  Tables                       │                                                                           ┃
   1.1 Math                      │ Table 1.1: Some tools                                                     ┃
   1.2 Wide                      │ ┌────────┬───────────────────────────────────────────────────┬─────────┐  ┃
 2  Code                         │ │ Tool   │ Description                                       │ Version │  ┃
                                 │ ╞════════╪═══════════════════════════════════════════════════╪═════════╡  ┃
                                 │ │ jq     │ Command-line JSON processor                       │   1.8.1 │  ┃
                                 │ ├────────┼───────────────────────────────────────────────────┼─────────┤  ┃
                                 │ │ csvkit │ A suite of utilities for converting to and        │   2.0.1 │  ┃
                                 │ │        │ working with CSV, the king of tabular file        │         │  ┃
                                 │ │        │ formats                                           │         │  ┃
                                 │ ├────────┼───────────────────────────────────────────────────┼─────────┤  ┃
                                 │ │ xsv    │ Fast CSV toolkit                                  │  0.13.0 │  ┃
                                 │ └────────┴───────────────────────────────────────────────────┴─────────┘  ┃
                                 │                                                                           ┃
                                 │ See Table 1.1.                                                            │
                                 │                                                                           │
                                 │ ┌────────────┬───────────┐                                                │
                                 │ │ Grid       │ Table     │                                                │
                                 │ ╞════════════╪═══════════╡                                                │
                                 │ │ Multi line │ a list    │                                                │
                                 │ │            │ in a cell │                                                │
                                 │ └────────────┴───────────┘                                                │
                                 │                                                                           │
                                 │ ┌───────┬───┐                                                             │
                                 │ │ Span  │ C │                                                             │
                                 │ ╞═══╤═══╪═══╡                                                             │
 1  Tables                                                                         ▶ terminal  term  2/3  Top 

Captions, header rows, cells that span columns, and cells with lists or several paragraphs all work.