ikskuh / kristall

Graphical small-internet client for windows, linux, MacOS X and BSDs. Supports gemini, http, https, gopher, finger.
https://kristall.random-projects.net/
GNU General Public License v3.0
738 stars 42 forks source link

Add option to collapse preformatted blocks, configuration option to set default #174

Open jamestomasino opened 3 years ago

jamestomasino commented 3 years ago

The preformatted text blocks have an alt text property following the three backticks which is designed to be a human-readable representation or indication of what is in the block. This feature gains value for blind users when our clients embrace it and allow it to be displayed instead of the wall of text common in ascii art or even code samples.

Davin Prater's post on the mailing list explains this from the POV of a blind user quite well.

As a feature request I would ask for two additions to Kristall to improve it for blind users:

  1. Allow preformatted blocks to toggle visibility, labeled with their alt-text representation or a generic fallback
  2. Allow the collapsed state to be set as the default in a configuration option
ghost commented 3 years ago

@jamestomasino mentioned on IRC that they've not specified the generic fallback, in the case that no alt-text is given. I suggest(ed) that a simple 'missing alt-text' or 'no alt-text provided' message be used.

mikejzx commented 3 years ago

I think this feature might be possible, however the only implementation method I can think of (using the current infrastructure) is extremely hacky. (Since kristall works by literally writing to a rich text document and displaying it to the user)

My solution would be like follows: say a user has collapsible blocks enabled, Kristall would render the document similar to this (mocked up in GIMP):

image

And then when a user clicks on the KristallTextBrowser widget, send the QTextCursor to that block (using the mouse click position), delete the block, and insert a new block with the preformatted text:

image

I guess the same approach could be used to fold the uncollapsed block too

This all seems pretty dodgy but it might work.

ikskuh commented 3 years ago

I think this solution isn't that bad actually. We could do that!