Skip to content

Commit e20db2e

Browse files
turt2liverichvdh
authored andcommitted
Merge pull request #2557 from matrix-org/travis/msc/spoiler-fallback
MSC2557: Proposal to clarify spoilers
2 parents b81d9fc + df41947 commit e20db2e

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

proposals/2010-spoilers.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@ Sometimes, while you want to put text into a spoiler to not have people accident
33

44
For example, when discussing a new movie or a TV series, not everyone might have watched it yet.
55
In such cases it would make sense to add a spoiler so that only those who have seen the movie or
6-
don't mind spoilers read the content.
6+
don't mind spoilers read the content.
77
Another example would be e.g. in mental health communities where certain people have certain
88
triggers. People could put talking about abuse or the like into a spoiler, to not accidentally
9-
trigger anyone just reading along the conversation.
9+
trigger anyone just reading along the conversation.
1010
Furthermore this is helpful for bridging to other networks that already have a spoiler feature.
1111

1212
To render the spoiler the content is hidden and then revealed once interacted somehow
1313
(e.g. a click / hover).
1414

1515
## Proposal
1616
This proposal is about adding a new attribute to the `formatted_body` of messages with type
17-
`m.room.message` and msgtype `m.text`.
17+
`m.room.message` and message types which support the `org.matrix.custom.html` format.
1818

1919
It adds a new attribute, `data-mx-spoiler`, to the `<span>` tag. If the attribute is present the
2020
contents of the span tag should be rendered as a spoiler. Optionally, you can specify a reason for
2121
the spoiler by setting the attribute string. It could be rendered, for example, similar to this:
2222

2323
![Spoiler rendering idea](images/2010-spoiler-example.gif)
2424

25+
The plaintext fallback supported by the `body` is optional. A recommendation for clients is included
26+
below.
27+
2528
To preserve the semantics of a spoiler in the plaintext fallback it is recommended to upload the contents of the spoiler
2629
as a text file and then link this: `[Spoiler](mxc://someserver/somefile)` and
2730
`[Spoiler for reason](mxc://someserver/somefile)` respectively.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# MSC2557: Clarifications on spoilers
2+
3+
Spoiler messages are described in [MSC2010](https://github.com/matrix-org/matrix-doc/pull/2010)
4+
though the MSC is unclear if the fallback is required to be sent by clients.
5+
6+
## Proposal
7+
8+
The fallback for spoiler messages is optional, though recommended to be sent by clients. Clients
9+
should make reasonable efforts to represent the spoiler in the `body` field of a message.
10+
11+
The recommended fallback format is unchanged.
12+
13+
Additionally, this proposal opens up spoilers to any HTML-supporting message types. Currently
14+
this includes `m.text` (already included by MSC2010), `m.notice`, and `m.emote`.
15+
16+
## Potential issues
17+
18+
Clients could inadvertently spoil parts of a message by not representing the spoiler correctly
19+
in the `body` of the message. The author believes this would quickly show up as a bug report
20+
on the client due to the nature of spoilers.

0 commit comments

Comments
 (0)