Adds option to handle preformatted code blocks in different ways for gemini #148

Merged
sloum merged 3 commits from gemini-alt-text into release-2.3.0 1 year ago
sloum commented 1 year ago
Owner

Adds the option geminiblocks with the valid types: block, alt, neither, both.

This is intended to be an accessibility fix that is slightly ahead of the spec. My hope is to make it a working model for moving forward with alt text associated with preformatted text blocks.

When set to block you will just see the contents of the preformatted block. Alt will show just the alt text, if it exists. Neither and both do what they sound like.

This also brings things more inline with the spec by using strings.HasPrefix(str, "```") to detect preformatted lines. The main branch currently looks for the exact line \n which will break with alt text or accidental whitespace. The spec specifically states that any line that starts with should toggle on or off a preformatted block.

Lastly, the previous way of handling blocks still allowed links to be rendered within a preformatted block, which is against the spec. This patch resolves that issue, which will allow text/gemini to self document itself more easily.

Adds the option `geminiblocks` with the valid types: `block`, `alt`, `neither`, `both`. This is intended to be an accessibility fix that is slightly ahead of the spec. My hope is to make it a working model for moving forward with alt text associated with preformatted text blocks. When set to block you will just see the contents of the preformatted block. Alt will show just the alt text, if it exists. Neither and both do what they sound like. This also brings things more inline with the spec by using `strings.HasPrefix(str, "```")` to detect preformatted lines. The main branch currently looks for the exact line ```\n which will break with alt text or accidental whitespace. The spec specifically states that any line that starts with ``` should toggle on or off a preformatted block. Lastly, the previous way of handling blocks still allowed links to be rendered within a preformatted block, which is against the spec. This patch resolves that issue, which will allow text/gemini to self document itself more easily.
sloum added the
enhancement
gemini
labels 1 year ago
Poster
Owner

A good page to test this with is: gemini://rawtext.club/~sloum/test.gmi

It is very short and simple, but contains alt text. Unlike many features in Bombadillo, you need to refresh/reload the page (R) to see a change to the setting due to needing to reparse the document.

A good page to test this with is: gemini://rawtext.club/~sloum/test.gmi It is very short and simple, but contains alt text. Unlike many features in Bombadillo, you need to refresh/reload the page (`R`) to see a change to the setting due to needing to reparse the document.
sloum closed this pull request 1 year ago
sloum deleted branch gemini-alt-text 1 year ago
The pull request has been merged as ba38b78ca6.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.