[users] Tables in Gemtext
Sean Conner
sean at conman.org
Sat Jan 2 04:55:23 GMT 2021
It was thus said that the Great Kiëd Llaentenn once stated:
> Hello,
>
> Just recently I was creating a Gemini mirror of an HTTP site, and came
> across several pages that made heavy use of tables. I did what I suspect
> most Gemini publishers/content authors do: use ASCII tables, like so:
>
> +--------------------------------+-------+
> | Food | Price |
> +--------------------------------+-------+
> | Eggs | $2 |
> | Eggs and spam | $4 |
> | Eggs, spam, eggs and spam | $8 |
> | Spam spam baked beans and spam | $8 |
> | Just spam | $2 |
> +--------------------------------+-------+
>
> There are several problems with this approach, though:
>
> 1. It requires the client to display the table in a monospaced font,
> which many would prefer not to use.
> 2. Text in table rows won't be wrapped properly on narrow displays.
> 3. ASCII tables are anything but screenreader friendly, since there's no
> semantic information about the table's structure.
> 4. It mixes information and presentation, which is against the spirit of
> Gemini(?)
>
> So, are there any other options for having tables in Gemtext, other than
> adding a new syntax to the spec? I'm hard pressed to think of another
> solution.
There's not much choice you have in this matter. I use preformatted
blocks for HTML tables, you can see two examples of which here:
gemini://gemini.conman.org/boston/2020/12/28.1
The format I use works because I only use HTML tables for actual tabular
data and *not* for layout purposes. The output uses tabs (HT, or character
9) between each field. The <caption> becomes the first line; the <thead>
(table header) is followed by a line of dashes; any <tfoot> section will
appear at the bottom of the table, again separated by dashes.
I don't bother with any further decorations (like you have) because I
don't feel its necessary (and if a cut-n-paste keeps the tab characters, it
becomes rather easy to manipulate the data).
-spc
More information about the Gemini
mailing list