💾 Archived View for rawtext.club › ~sloum › geminilist › 007150.gmi captured on 2023-11-14 at 08:49:00. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

<-- back to the mailing list

Syntax highlighting

Omar Polo op at omarpolo.com

Mon Sep 20 08:22:45 BST 2021

- - - - - - - - - - - - - - - - - - - 

Nathan Galt <mailinglists at ngalt.com> writes:

On Sep 19, 2021, at 1:43 AM, raingloom <raingloom at riseup.net> wrote:
On Sun, 12 Sep 2021 18:14:07 +0000
mntn at mntn.xyz wrote:
The Gemtext spec would seem to have no problem with this, as the
first line is considered "alt text" and it is up to the client to
determine both what should be done with it and how it should affect
the presentation. But I wanted to put this out there to get a broader
perspective.
That's not what alt text is. It's for screen readers. A bunch of people
are way into ASCII art so alt text is needed. They are image
descriptions.
I recommend the following instead:
Just name the language on the line before the <pre> block.
ie.:
lua:
```
local function whatever() end
```
This way you aren't making an accessibility feature worse by trying to
overload it to be some generic metadata container.
Someone floated the idea of using the leading ``` line for alt text
and the trailing ``` line for language colorization (or maybe the
reverse). It sounded like a good idea to me, but the current
maintainer of the Gemini spec (not unreasonably) has a
try-it-first-and-report-back attitude to these sorts of things and, as
far as I can tell, nobody’s modified a Gemini browser to try this sort
of thing out.

Using the trailing ``` has a ugly drawback: we have to read all the codeblock before being able to colorize it. Gemini has a really niceproperty of needing only the first few bytes of each line to decide its"type", there's no going back and forward like it is for markdown (wherelink references can be declared after the link itself) or HTML. Thisallows a really cool property: text/gemini files can be *streamed* onthe fly and easily parsed on the fly. For instance: a irc-likeapplication can have a page that never stop loading where all themessage "appear" as soon as someone sends them, and a second page wherethe users can send text.

That said, regarding the try-and-report part, if someone really wants tosee how this could work, I suggest try hacking something on top ofelpher: Emacs is really cool for this kind of things and already hassyntax highlighting for various programming languages.

Cheers,