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 2020-05-22 21:50:00 +00:00
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 2020-05-18 04:58:35 +00:00
Author
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 2020-05-22 21:50:00 +00:00
sloum deleted branch gemini-alt-text 2020-05-22 21:50:08 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#148
No description provided.