-
Notifications
You must be signed in to change notification settings - Fork 45
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
Feature request: Spoiler messages #167
Comments
Hm, I hadn't seen that before. Well, it might not be too hard to implement, actually. We could probably override the I'd be glad if someone else would like to work on this. I'll offer guidance, of course. |
How about the patch below? It does not handle plain text bodies as I don't see any particular format being enforced so we might need to do some funny business if we decide to also support plain text bodies (who else other than me uses it BTW?)
|
@Vizs That looks like a good start, thanks. BTW, I'm not sure what you mean about plain-text bodies. All I know is what is shown in the spec. |
Even though the example event given by treed and the Matrix spec suggest that there is a fixed format for spoiler boundary markers in plain text bodies, that seems to be not the case. For example, notice how there's no
Here's another example of a message with spoiler generated by the t2bot discord bridge:
|
@Vizs I see, thanks. IMO we should strictly adhere to the spec here, and any clients that don't follow it are sending spoilers at their own risk. :) |
The first example I showed above was a message sent using Element. If Element does not care about doing the right thing TM, then anything goes for other clients. (: In the end, it is your call as to decide whether we should support markdown-style spoiler message or just inconvenience plain text body users. |
IIUC even Element is "inconveniencing plain text body users," right? It's hard enough to support the many features of the spec without also having to support pre-spec, proposed/experimental behaviors too. Let's just follow the spec here. They'll probably update Element to follow it eventually. |
Yes, that is the case. A lot of times, you lose out when you use plain text body. Personally, I gave up on plain text body, and change shr-external-render-functions to render HTML like plain text. |
I don't understand what you mean about that. |
I worked more on rendering spoilers in plain text bodies---falling back to search-and-replace when the plain text body does not include the spoiler as a MD link. This seems to work in my minimal testing, but it is rather hard to present the changes since my patch is on top of the rich-reply changes in #150 (and a rather old copy of that PR, at that). I would happy be to make a PR for spoiler message rendering once the rich-reply support is merged in. In any case, if you are interested the patch is at https://gist.github.com/vizs/458a3a95d6d93a128182030c588bfabd. As for sending spoiler messages, I think a command like the reaction command would be in order? I'm not sure how you want to implement it. |
Ok. I'm still not sure what the best course of action is with regard to the rich replies. I guess it should be gated behind an option.
The best idea I have would be to use Org's strikethrough syntax and rebind the Org export HTML function for that syntax to output the spoiler tags. Of course, that would preclude writing messages with actual strikethrough syntax, so maybe we should use something else. |
Sending rich replies can be gated under an option but I hope rendering won't be. As per the protocol, one should include the fallback in the event body when sending a rich reply but clients can be lazy and not include them (which is why I made the PR in the first place).
I don't think you can think up new markup syntax in org (like = + and friends) but write a special block like #+BEGIN_SPOILER. Unfortunately, this would be well beyond my abilities to implement. |
Yes, that's what I meant.
Maybe, but see variable I wonder if we should just implement our own, very simple syntax, something like:
that would render like
|
I came across this in Element today, where the text was fuzzed until clicked on. I was surprised to learn that it's actually in the spec (Spoiler message) as of 1.1.
I'm not entirely sure how this could be implemented. Appearance seems relatively easy, but I can imagine it being hard to get the info out of
shr
. Maybe just detecting the data-mx-spoiler string and making the whole thing a spoiler in the worst case. I guess you'd also need to add another message action to reveal a spoiler.A syntax for marking spoilers may be trickier. I don't think there's a way to do anything like it in org. Element implements it for a whole message with a preceding
/spoiler
, but no way to mark parts of messages even though the spec allows it. There's some discussion of various formats at element-hq/element-meta#870Here's an example of a message containing a spoiler (with the actual spoiler removed even though it's not much of a spoiler without context):
Even if it takes longer to figure out how to send them, I think it's valuable to implement spoiler display. People using clients that support them could reasonably expect that the text they're sending is hidden to others without opt-in.
The text was updated successfully, but these errors were encountered: