Syntax highlighting

mntn mntn at mntn.xyz
Sat Sep 18 22:51:10 BST 2021


> Personally I think using the MIME type would be most sensible, it's
> what's already done when a page is received, so it'd make development
> easier for clients.
> (I'm including non-""official"" MIME types. The ""official"" coverage
> of source code files is a bit lacking)

You have a good point. I wonder "why not both" -- a client could make a best effort to detect the
language using several methods. For the example listed, "js" may also be appropriate alt text for
JavaScript. Again, if it can't be parsed as the detected language, it wouldn't be highlighted.

> However, I imagine making a screen-reader read code would be absolute hell!
> So it would be extremely useful for this to be a thing, so the code
> can be roughly described in a screen-reader safe way.

That's exactly what I was thinking. I think this would both benefit users with screen readers (so
they know what's coming) and people like myself who find it easier to parse code with some syntax
highlighting in place.

I can also imagine a highly advanced screen reader that might be able to parse code and present
some kind of intelligent navigation. (Next/previous statement or expression, enter or exit nested
code, etc.) I don't believe this exists today, but I can imagine it!


More information about the Gemini mailing list