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 for inline spoilers / spoiler tags #17115

Open
trwnh opened this issue Dec 9, 2021 · 3 comments
Open

Support for inline spoilers / spoiler tags #17115

trwnh opened this issue Dec 9, 2021 · 3 comments
Labels
suggestion Feature suggestion

Comments

@trwnh
Copy link
Member

trwnh commented Dec 9, 2021

Pitch

Summary

Similar to how mentions and hashtags are metadata with inline representations, I propose support for an additional type of metadata: spoiler tags.

ActivityPub representation

Just like mentions and hashtags, spoiler tags can be added to the tag property on a Note:

{
...
  "content": "@trwnh Personally, I was really surprised when I found out that Darth Vader is Luke Skywalker's father. #mindblown"
  "tag": [
    {
      "type": "Mention",
      "href": "https://mastodon.social/users/trwnh",
      "name": "@trwnh"
    },
    {
      "type": "Spoiler",
      "name": "Darth Vader is Luke Skywalker's father"
    },
    {
      "type": "Hashtag",
      "href": "https://mastodon.social/tags/mindblown",
      "name": "#mindblown"
    }
  ],
...
}

Mastodon API

Perhaps a spoiler_tags property on the Status entity? This could be an array of Strings to search through content and hide upon finding each string. To remove ambiguity, perhaps include a <span> tag, maybe something like <span class="spoiler">Darth Vader is Luke Skywalker's father</span>. This would not violate the current HTML sanitizer or the API expectations.

Client UI

This is potentially the most contentious part of the feature request, as the most natural way to add support for this feature would be through a different controversial feature request: rich text formatting. Discord handles spoilers by using || as a delimiter at the start and end of the spoiler text; some forums use pseudo-HTML <spoiler></spoiler>, and so on, but IMO the most natural way is to provide a button on highlight that will mark the selected text as a spoiler. However, there's nothing stopping the adoption of another syntax for this, similar to @ for mentions and # for hashtags -- perhaps %[], or simply reusing Discord's ||||.

Motivation

Sometimes you want finer-grained control and don't want to hide an entire status behind a CW, which would make the entire status be marked as "sensitive" and introduce knock-on effects for things like image attachments and potential filtering by certain clients.

@shleeable
Copy link
Contributor

I could imagine this could extend to the inline text, but I know big G doesn't want markdown or anything in the toots.

something awful method always made sense.
image
Clicking on the black.
image

@RokeJulianLockhart
Copy link

RokeJulianLockhart commented Oct 16, 2023

We could use LemmyNet/lemmy-ui#687 (comment)

<spoiler></spoiler>

tags like https://help.disqus.com/en/articles/1717306-spoiler-tags

@georgeh
Copy link

georgeh commented Nov 2, 2023

When USENET was used for discussions, people would frequently use rot13 encoding for spoilers. The content block of the note could potentially be rot13'd to prevent spoilers from displaying on other ActivityPub platforms. e.g.:

{
...
  "content": "@trwnh Personally, I was really surprised when I found out that Qnegu Inqre vf Yhxr Fxljnyxre'f sngure. #mindblown"
  "tag": [
    {
      "type": "Mention",
      "href": "https://mastodon.social/users/trwnh",
      "name": "@trwnh"
    },
    {
      "type": "Spoiler",
      "name": "Qnegu Inqre vf Yhxr Fxljnyxre'f sngure",
      "encoding": "rot13"
    },
    {
      "type": "Hashtag",
      "href": "https://mastodon.social/tags/mindblown",
      "name": "#mindblown"
    }
  ],
...
}

@vmstan vmstan added the suggestion Feature suggestion label Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Feature suggestion
Projects
None yet
Development

No branches or pull requests

5 participants