|
| 1 | +# MSC4313: Require HTML `<ol>` `start` Attribute support |
| 2 | + |
| 3 | +The Matrix specification allows text messages to optionally contain a HTML-formatted version over the plain text |
| 4 | +body. |
| 5 | +A set of "safe" tags is recommended, along with a set of "safe" attributes for some of the tags that |
| 6 | +support them. |
| 7 | +Additional Matrix-specific attributes are also introduced. However, all of this is optional on any level: |
| 8 | +Clients may choose for example to |
| 9 | +- not implement sending or showing or HTML-formatting at all |
| 10 | +- only implement some tags |
| 11 | +- implement additional tags outside of the existing recommendation |
| 12 | + |
| 13 | +This can lead to problems in terms of interoperability: |
| 14 | +If a sending client sends certain markup that implies some information, and a receiving client does |
| 15 | +not support that markup, removing it as it displays the message, then the received message is not |
| 16 | +complete and thus has possibly altered meaning. |
| 17 | + |
| 18 | +Specifically, over the last decade of Matrix, clients have repeatedly had issues with ordered lists. |
| 19 | + |
| 20 | + |
| 21 | +## Proposal |
| 22 | + |
| 23 | +Imagine the following conversation to illustrate: |
| 24 | + |
| 25 | +Alice asks: |
| 26 | +1. \<a very long option\> |
| 27 | +2. \<another very long description\> |
| 28 | +3. \<a huge third description\> |
| 29 | + |
| 30 | +Bob replies: |
| 31 | +2. |
| 32 | + |
| 33 | +Let's assume Bob's client takes the option to translate the plain text `2.` to HTML. |
| 34 | +Assuming further that Bob's client has full support to the extent recommended by the spec, then Bob's |
| 35 | +message becomes `"formatted_body": "<ol start=\"2\"></ol>"`, i.e. an ordered ("numbered") list with a single, |
| 36 | +empty entry, that starts at an index of two. |
| 37 | + |
| 38 | +Let's assume Alice's client also implements HTML markup in a configuration allowed by the spec: |
| 39 | +Her client supports `ol` tags, but not the `start` attribute. |
| 40 | +A common implementation is to parse the HTML and simply remove any tags not implemented by the client. |
| 41 | +After safely ingesting the message, Alice's client ends up with `"formatted_body": "<ol></ol>"`. |
| 42 | +Rendering this, Alices screen shows: |
| 43 | + |
| 44 | +Bob said: |
| 45 | +1. |
| 46 | + |
| 47 | +This is a clear break in communication, since this message has an entirely different meaning not only |
| 48 | +from Bob's intended meaning, but also as it is viewed from different client implementations. |
| 49 | + |
| 50 | +This MSC proposes to alter the spec such that a client implementing rendering of the `ol` HTML tag |
| 51 | +in `formatted_body`s is also required ("MUST") to implement its `start` attribute, in oder to prevent |
| 52 | +loss of meaning of a message. |
| 53 | + |
| 54 | + |
| 55 | +## Potential issues |
| 56 | + |
| 57 | +This proposal increases the load on client developers, though presumable only a tiny bit, |
| 58 | +which could mean that fewer clients could choose to implement `ol` at all. |
| 59 | + |
| 60 | + |
| 61 | +## Alternatives |
| 62 | + |
| 63 | +- Define a list of all HTML tags whose displaying must be supported if `formatted_body` is used to display |
| 64 | + messages at all, based on whether tags can replace characters such as in the demonstrated example. |
| 65 | + This could apply recursively also for all attributes. |
| 66 | +- Find a way for clients to dermine whether the `body` matches its supported interpretation of the |
| 67 | + `formatted_body`. |
| 68 | + This could end up very similar to the previous alternative and additionally lead to inconsistent |
| 69 | + behavior on clients where `formatted_body` is only sometimes used for display as a result. |
| 70 | +- Remove HTML from the spec entirely. Possibly replace it with another markup language that prevents |
| 71 | + this issue. |
| 72 | + |
| 73 | + |
| 74 | +## Security considerations |
| 75 | + |
| 76 | +No potential security issues are known to the author. |
| 77 | +Only options already allowed are being defined more precisely. |
| 78 | + |
| 79 | + |
| 80 | +## Unstable prefix |
| 81 | + |
| 82 | +Not required, since implementations of this MSC would only allow an existing subclass of the currently legal |
| 83 | +HTML-formatted messages. |
| 84 | + |
| 85 | +## Dependencies |
| 86 | + |
| 87 | +None. |
0 commit comments