CKAN icon indicating copy to clipboard operation
CKAN copied to clipboard

[Feature][UI] Description field - support simple markup

Open mwerle opened this issue 5 years ago • 3 comments

Problem

Is your feature request related to a problem? Please describe. Longer descriptions are just a contiguous unformatted blob of text, making it difficult to read.

Suggestions

Describe the solution you'd like Support a recognised markup scheme (my favourite would be "Markdown", or at least a sub-set of it) in order to allow people to add nice-looking descriptions for their mods from within the CKAN GUI.

Describe alternatives you've considered Support a custom very simple markup format with a very restricted set of markup (eg, newlines, bold, italic), the most important of which is support for newlines.

Possible Issues How would the Command-line tools render this?

Additional context Look at "Nehemiah Engineering Orbital Science" for a mod which would benefit from at least having line-breaks in its description. (In fact, line-breaks are in the meta-data, but are not displayed)

mwerle avatar Jun 23 '19 12:06 mwerle

On my system (Kubuntu using mono 5.20.1.19) line-breaks are displayed, which OS are you using?

It's only a handful of mods using the description field, so in my opinion there's only a very little benefit of adding bold and italic formatting support, and creating a new standard just for that.

'Easiest' to implement would probably be Microsoft's RTF (in case mono is supporting it), but that's a pain to write, looking at the given example.

Everything else will be really complicated, since we either need to parse it to RTF and display it in a RichTextBox, or create a custom Label/TextBox derived class controlling the rendering directly with GDI+. That's what I got from here: https://stackoverflow.com/questions/11311/formatting-text-in-winform-label

Or somebody finds a good library with the right licence.

DasSkelett avatar Jun 23 '19 13:06 DasSkelett

I've been mostly working on Windows recently (I miss my Linux!!) so possibly a "\r\n" vs "\n" issue (I put "\n" into the description) . Would have thought it would render either correctly or incorrectly regardless of host OS. So that might be something to look into.

And yes, I know only a few mods use "Description" so far, but it would be nice if more did, allowing users to browse mods in CKAN instead of having to click on the links to get more information. Was just a thought that making it look more appealing might garner more support.

So yes, this is mostly a very low priority wishlist item.

mwerle avatar Jun 24 '19 01:06 mwerle

I've been looking at options for text formatting to address some unrelated issues with the auto update dialog, and it looks like this may not be possible to do well in a cross platform way. Mono's RichTextBox is shockingly, atrociously incomplete—if your document has something as simple as a bullet point character, RichTextBox prints an asterisk to the console instead of adding a bullet point to the application window; I'm not sure it handles any actual formatting at this point:

https://github.com/mono/mono/blob/f1db846a0ab24144adbd5847b93ee3c223db887e/mcs/class/System.Windows.Forms/System.Windows.Forms/RichTextBox.cs#L1990-L1993

(Update: It doesn't seem to (handle any actual formatting); I tried using RTF syntax to make the font bold and larger, and it had no effect. Mono ships a plain textbox named RichTextBox. :vomiting_face:)

And Mono's WebBrowser doesn't work at all! It displays NOTHING in the application and prints this to the console:

libgluezilla not found. To have webbrowser support, you need libgluezilla installed

(Side note, I do have libmono-webbrowser4.0-cil installed, as suggested by most StackExchange discussions of this error. So that doesn't solve it, and even if there is some other solution, supporting all Linux users through it is not viable.)

So the two big obvious options for displaying formatted text in WinForms, are essentially Windows-only solutions. Even if a third party control could do this (I'm skeptical because if it was that easy, why can't Mono do it?), that would amount to embedding a web browser in ckan.exe, which seems like kind of extreme overkill for one or two dialogs.

HebaruSan avatar Jan 09 '21 03:01 HebaruSan