[users] Tables in Gemtext

Luke Emmet luke at marmaladefoo.com
Sat Jan 2 18:13:45 GMT 2021

On 02-Jan-2021 03:04, Kiëd Llaentenn wrote:
> 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.
Some other ideas:

If you want to present the information in its original structure, there 
are other options
(as well as trying to inline it into gemtext preformatted text already 
discussed on this thread):

1. provide link to a CSV
2. serialise as simple text
3. If you just want to preserve the visual appearance, you could also 
provide a link to a rendered PDF

For option 2, most tables can be "flattened" in a way that users can 
usually get the idea of that was there. In my own html2gmi app [1] it 
has this as an option for processing tables as well as the "preformatted 
text layout":

⊞ table ⊞

Food Price
Eggs $2
Eggs and spam  $4
Eggs, spam, eggs and spam $8
Spam spam baked beans and spam $8
Just spam $2

Works fine for your table above IMHO. Or you could use some similar 
variant approach of this.

I grant you this won't help for complex tables, but for those your 
options are limited apart from option 1 and 3 if you want to keep the 
full original appearance or structure.

  - Luke

[1] https://github.com/LukeEmmet/html2gmi

More information about the Gemini mailing list