Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Syntax highlighting for preformatted text blocks that have alt text indicating a programming language #252

@mntn-xyz

Description

@mntn-xyz

From the Gemini spec:

"Anything which comes after the ``` characters of a line which toggles preformatted line on (i.e. the first, third, fifth, etc. toggling lines in a document) may be treated as "alt text" for the preformatted content. In general you should not count on this content being visible to the user but, for example, search engines may index it and screen readers may read it to users to help the user decide whether the preformatted content should be read aloud (which e.g. ASCII art generally should not be, but which source code perhaps should be). There are currently no established conventions on how alt text should be formatted."

Many Markdown implementations, for instance, use a similar mechanism to identify the language for syntax highlighting:

```html
<p>This is HTML</p>
```

It seems like it is inevitable to have some kind of syntax highlighting convention in Gemini, especially given its usage within tech-centric circles. Given that the spec leaves alt text wide open for interpretation by the client, I thought that it might be worth investigating this use case in amfora.

Hugo uses a fantastic Go library called Chroma for its syntax highlighting. Chroma explicitly supports highlighting with 8-bit and 256-bit terminal colors, so it should be a good match.

Metadata

Metadata

Assignees

Labels

UIDeals with the visual user interfaceenhancementNew feature or requestroadmapA user-facing feature on the roadmap.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions