[spec] Possible Tables Syntax

zwatotem at gmail.com zwatotem at gmail.com
Sun Jan 3 15:06:41 GMT 2021
First of all, **Hello**, as it's my first message here.
I like the original idea to some extent. It bothers me, that what is meant
to be a row doesn't actually lay in one line. I immediately wanted to
propose usage of TSVs as they are pretty human readable and have a good
support in many text parsers. I don't want explicit support for tables, but
rather making TSV inside a preformatted block a *best practice* for
presenting data of tabular form. Fancy clients could have support for a
technique of HT rendering known as [elastic
tabstops](https://nickgravgaard.com/elastic-tabstops/) (tl;dr render tabs in
blocks of neighboring lines to the same stop point, widening ones that are
too short, if needed). But then simple terminal-based clients aiming to
benefit from one-scan-to-render feature of text/gemini would suffer with all
the usual problems we know from attempts to display TSV in the terminal.

Example data (pure TSV):
```
Name	Age	Address
Paul	23	1115 W Franklin
Bessy the Cow	5	Big Farm Way
Zeke	45	W Main St
```

Elastically rendered (using more tabs here, for illustration):
```
Name			Age	Address
Paul			23	1115 W Franklin
Bessy the Cow		5	Big Farm Way
Zeke			45	W Main St
```

Solution could be to implement elastic tabstops in a greedy manner (align to
the widest cell so-far). I think that greedy renderer is a good midpoint
between naive aligning to nearest multiples of 4 (or 8 or whatever) and full
elastic tabstops rendering. With this we could encourage users to make a
table header containing cells of maximum needed length (for example by
padding the remaining width with spaces). Obvious flaw of this solution is
requiring text author to know the maximum widths of their columns (which can
potentially be big raw data impossible to look up). But then TSV will look
like table no matter what.

Greedy/semi elastic render (without padded header) (`Name` column made wider
after encountering Bessy the Cow cell):
```
Name	Age	Address
Paul	23	1115 W Franklin
Bessy the Cow		5	Big Farm Way
Zeke			45	W Main St
```
Now that I think about it, this has little to nothing to do with spec (maybe
I should send it to [tech] as well, or instead) as all of this can be put in
best practices or even emerge as non-written standard for
formulating/rendering documents. However, I think this is an interesting use
of an uncommon text rendering technique to make plaintext capable of
presenting tabular data. Let me know, what you think about that.

Grzegorz Przybylski aka Zwatotem










Archive home | About this archive