bleakgrey / tootle

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

Support for HTML tags in post content #205

Closed Lucidiot closed 4 years ago

Lucidiot commented 4 years ago

My instance uses glitch-soc, a fork of Mastodon that adds a few features on top of it such as Markdown/HTML toots. The user docs for this formatting are here.

I sent this toot in Markdown:

# 🍆

Tootle crashes on each startup with a warning similar to #44:

(com.github.bleakgrey.tootle:14509): Gtk-WARNING **: 21:26:09.232: Failed to set text '<markup><h1>🍆</h1></markup>' from markup due to error parsing markup: Unknown tag 'h1' on line 1 char 21
**
ERROR:/build/com.github.bleakgrey.tootle-0.2.0/src/API/NotificationType.vala:43:tootle_notification_type_from_string: code should not be reached
[1]    14509 abort      com.github.bleakgrey.tootle

I suppose there should be some sanitization on HTML input. The easy way would be to remove or escape everything, but that could remove external links or make some toots look strange. The other way is to convert a select few compatible HTML tags such as <h1> or <pre> and turn them into their Pango markup equivalent like <span size="x-large"> or <tt>.

bleakgrey commented 4 years ago

The crash is caused by a poll in your notifications timeline (see the next line). This is fixed in the master, but Tootle 0.2 for elementary OS is no longer supported and will not be updated. If you still want to use it, you should switch to Olifant.

If you can, please test it with the latest version in the master branch as it may be fixed already. Or not. I can't really remember, it's been quite a lot of fixes since 0.2. Anyway, sanitizing HTML for Pango is pain.