Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to display a limited set of HTML tags, aligned with Mastodon 4.2 #404

Merged
merged 3 commits into from
Nov 18, 2023

Conversation

danschwarz
Copy link
Collaborator

@danschwarz danschwarz commented Sep 23, 2023

This is essentially a rewrite of the closed PR #348 using @AnonymouX47 's TextEmbed widget from urwidgets. It does not suffer from the rendering issue that caused problems for the previous PR, that used urwid.Text. As a bonus, it includes support for clickable links on terminals that support OCS 8 hyperlinks.

If urwidgets library is not available, we fall back seamlessly to using urwid.Text and everything works as normal, you just don't get clickable links on terminals that support OCS 8 hyperlinks.

This PR renders all HTML elements, and some HTML attributes, that are supported in Mastodon 4.2 spec

As part of this PR, the "highlight followed hashtags" feature is removed from the TUI (it remains in the console.)

Hashtags are hyperlinks with a class of "hashtag" or "mention hashtag", so they are rendered as hyperlinks (and are clickable if OCS 8 support is available in the terminal). Hashtag hyperlinks are rendered in light cyan.

HTML Status on a glitch-soc server

image

The same status on the TUI with this PR

image

As the urwidgets dependency is Python 3.7+, I have removed the Python 3.6 automated Github tests.

HTML tag support is aligned with Mastodon 4.2 supported tags.
This code introduces a soft dependency on the urwidgets library.
If urwidgets is not available, HTML tags are still supported,
but hyperlinks are not underlined using the OCS 8 terminal
feature (on supported terminals).
@ihabunek ihabunek merged commit 584f598 into ihabunek:master Nov 18, 2023
10 checks passed
@danschwarz danschwarz deleted the richtext3 branch January 21, 2024 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants