-
Notifications
You must be signed in to change notification settings - Fork 401
MSC4313: Require HTML <ol>
start
Attribute support
#4313
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# MSC4313: Require HTML `<ol>` `start` Attribute support | ||
|
||
The Matrix specification allows text messages to optionally contain a HTML-formatted version over the plain text | ||
body. | ||
A set of "safe" tags is recommended, along with a set of "safe" attributes for some of the tags that | ||
support them. | ||
Additional Matrix-specific attributes are also introduced. However, all of this is optional on any level: | ||
Clients may choose for example to | ||
- not implement sending or showing or HTML-formatting at all | ||
- only implement some tags | ||
- implement additional tags outside of the existing recommendation | ||
|
||
This can lead to problems in terms of interoperability: | ||
If a sending client sends certain markup that implies some information, and a receiving client does | ||
not support that markup, removing it as it displays the message, then the received message is not | ||
complete and thus has possibly altered meaning. | ||
|
||
Specifically, over the last decade of Matrix, clients have repeatedly had issues with ordered lists. | ||
|
||
|
||
## Proposal | ||
|
||
Imagine the following conversation to illustrate: | ||
|
||
Alice asks: | ||
1. \<a very long option\> | ||
2. \<another very long description\> | ||
3. \<a huge third description\> | ||
|
||
Bob replies: | ||
2. | ||
|
||
Let's assume Bob's client takes the option to translate the plain text `2.` to HTML. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. arguably this is the bug, not the lack of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (also, why aren't they using polls?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spec says I may use (Whether to use polls or not is also not the question.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. err, all that you need to do to invoke this issue is typing in EXA that you like the |
||
Assuming further that Bob's client has full support to the extent recommended by the spec, then Bob's | ||
message becomes `"formatted_body": "<ol start=\"2\"><li></li></ol>"`, i.e. an ordered ("numbered") list with a single, | ||
empty entry, that starts at an index of two. | ||
|
||
Let's assume Alice's client also implements HTML markup in a configuration allowed by the spec: | ||
Her client supports `ol` tags, but not the `start` attribute. | ||
A common implementation is to parse the HTML and simply remove any tags not implemented by the client. | ||
After safely ingesting the message, Alice's client ends up with `"formatted_body": "<ol><li></li></ol>"`. | ||
Rendering this, Alices screen shows: | ||
|
||
Bob said: | ||
1. | ||
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For evidence, this is the case in Element X as of 25.07.0. Further evidence: nheko 0.12.0-9571d811 and SchildiChat ("classic") will show only whitespace here. |
||
|
||
This is a clear break in communication, since this message has an entirely different meaning not only | ||
from Bob's intended meaning, but also as it is viewed from different client implementations. | ||
|
||
This MSC proposes to alter the spec such that a client implementing rendering of the `ol` HTML tag | ||
in `formatted_body`s is also required ("MUST") to implement its `start` attribute, in order to prevent | ||
loss of meaning of a message. | ||
|
||
|
||
## Potential issues | ||
|
||
This proposal increases the load on client developers, though presumable only a tiny bit, | ||
which could mean that fewer clients could choose to implement `ol` at all. | ||
|
||
|
||
## Alternatives | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you prevent the sending client from turning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Independent of where this MSC goes I feel like this ("better logic for when to convert There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I change my example, because apparently many reviewers are missing the issue I am trying to point out for another issue. It is currently legal and intended within the Matrix spec for Alice to type:
and Alice's client to send this as The above is a legal message, and there are valid use cases to get there. This Then the issue is that Bob's client missing support for
What I at this point regard as out of scope of this MSC (convince me otherwise?) is prescribing to clients how to and how not to generate their HTML. Possible ways for clients to construct
So to get rid of erratic behavior, the spec could try to come up with rules trying to cover a million edge and corner cases that prevent a simple answer of An easy alternative would be to disallow Can anyone find a reference as to when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think fixing the I was just thinking that when I type "4. Juli", I actually wouldn't want it to become an ordered list starting at 4. Even if it's displayed similarly, semantically it's something very different from what I intended. Agree that this is a different problem though and should be solved in another proposal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To be clear, I agree that this is annoying and suboptimal, and clients should do better. I am not sure though if this even falls into the area of concern of the spec. |
||
|
||
- Define a list of all HTML tags whose displaying must be supported if `formatted_body` is used to display | ||
messages at all, based on whether tags can replace characters such as in the demonstrated example. | ||
This could apply recursively also for all attributes. | ||
- Find a way for clients to determine whether the `body` matches its supported interpretation of the | ||
`formatted_body`. | ||
This could end up very similar to the previous alternative and additionally lead to inconsistent | ||
behavior on clients where `formatted_body` is only sometimes used for display as a result. | ||
- Remove HTML from the spec entirely. Possibly replace it with another markup language that prevents | ||
this issue. | ||
|
||
|
||
## Security considerations | ||
|
||
No potential security issues are known to the author. | ||
Only options already allowed are being defined more precisely. | ||
|
||
|
||
## Unstable prefix | ||
|
||
Not required, since implementations of this MSC would only allow an existing subclass of the currently legal | ||
HTML-formatted messages. | ||
|
||
## Dependencies | ||
|
||
None. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is already implemented in Element-Web, Element X iOS, Element classic iOS, Fractal, FluffyChat 2.0. There are likely more. What do you need as confirmation?
Implementations meeting this proposal but with limited issues (such as not rendering the number when the item has no content) exist, e.g. Nheko 0.12.0-9571d811, NeoChat, Element/SchildiChat classic, FluffyChat 1.25.
A counter-example would be Element X Android.