Syntax highlighting
mntn mntn at mntn.xyz
Mon Sep 13 16:17:46 BST 2021
Thanks, I read over it and the deeper linked conversations. It looks like people have been considering this from a number of angles. It does seem like a lot of people were suggesting changes to the spec; I don't want to add anything new! Gemini is fine as it is.
I am confident that the best option is just to use the name of the language as the alt text. Alt text of "javascript" is fairly clear as to what follows in the preformatted text block--so it still works as alt text--and a syntax highlighter could use that hint for parsing the text and highlighting the code. A properly designed syntax highlighter will give up and fail quietly/safely if it can't parse the code for whatever reason, say if it's actually a poem titled "javascript" instead of code.
Clients may want to ignore anything following a space or punctuation, so alt text could be even more descriptive, such as "javascript: excerpt from example.js" or "HTML example."
This would seem to be compatible with the spec as it stands, it doesn't munge the alt text, and it doesn't add any new requirements for clients.
September 12, 2021 5:57 PM, "Alexis" <flexibeast@gmail.com> wrote:
> mntn@mntn.xyz writes:
>
>> I'm interested in opinions on syntax highlighting for > preformatted
>> text. Gemini has a lot of potential for distraction-free > developer
>> reference (I just discovered that godocs.io works in Gemini!) > and
>> syntax highlighting would help.
>>
>> [...]
>>
>> 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.
>
> There was a thread on this topic some months back:
>
> https://mailing-list-archive.gemi.dev/www/2021/005732.html
>
> Alexis.
Archive home | About this archive