bleakgrey / tootle

GTK-based Mastodon client for Linux
GNU General Public License v3.0
401 stars 61 forks source link

Fix markup lists and inline image (pleroma) #233

Closed dec05eba closed 3 years ago

dec05eba commented 4 years ago

Without this change it shows Lorem Lipsum placeholder text if a post contains lists or inline images.

Right now it will display inline images as hyperlinks, but it should probably be changed to download the image and display it inline. That should be done in another task unless its simple to do.

I also tried to fallback to non markup mode for the label if pango fails to parse the markup but pango fails to parse tags, even though setting tags works if you set them directly with label = ...

dec05eba commented 4 years ago

This is how it looks like after this change: https://user-images.githubusercontent.com/66856951/92995762-a2e8dc00-f506-11ea-9e76-5405141116ca.png and here is how it looks like in a web browser: https://user-images.githubusercontent.com/66856951/92995764-ae3c0780-f506-11ea-8f07-5f7d4503a04e.png

bleakgrey commented 4 years ago

Well this escalated into a regex hell pretty quick

dec05eba commented 4 years ago

Yeah, but i think with this it should be final. I tested all possible markdown and this seems to work for all the ones pleroma uses, unless we want to use a real html parser here but that sounds too much

bleakgrey commented 4 years ago

I thought about introducing an HTML parsing class before, and looking at this regex spaghetti I think it may be a good time for me to do some research.

In the end it might be a good idea to inject a Gtk.Box with separate widgets for p, code, and img tags to the post view instead of setting a text parameter for a single RichLabel widget.