gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
10 stars 6 forks source link

Allow rich help texts (incl links) #148

Open MortenHofft opened 3 years ago

MortenHofft commented 3 years ago

It seems reasonable to allow for richer help texts than just a single unformatted string. Currently that isn't an option.

To do this I imagine allowing markdown in the descriptions, parse it at build time. Sanitize it at build time. And update the locale file with those values. And perhaps sanitize once again when rendering the content.

For any browser sanitization, then DomPurify seems a reasonable library to do so as it is 17kb vs santize-html 170kb unzipped.

I'm not sure just how far to go in terms of allowed html. Images? Videos? only links and italics and paragraphs?

@tucotuco am I imagining this need or did you miss it while doing https://github.com/gbif/gbif-web/pull/18

tucotuco commented 3 years ago

@MortenHofft I don't understand. I admit I thought about links to term definitions when writing suggest texts, but I didn't think they would work and I worried about language issues at the destinations of the links.

timrobertson100 commented 3 years ago

Currently, the help texts are only strings and display like this:

image

The question is whether we should support more structured text in that, and how far to go. I'd think starting with a small subset that allowed links (e.g. to the forthcoming documentation site), bold, pre, italics, paragraphs, and lists would be plenty (Tables, images, videos seem over the top for inline help).

tucotuco commented 3 years ago

@timrobertson100 I think that is a good target, as I still worry about how translations would work in more complex presentation (e.g., translated text fitting the same inside a table, etc.).