-
Notifications
You must be signed in to change notification settings - Fork 380
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
MSC2191: Markup for mathematical messages #2191
Conversation
(FYI, matrix-org/matrix-react-sdk#3251 just arrived) |
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.
While I don't have a conclusive "ship it!" opinion about this I certainly believe we should pursue the LaTeX path rather than the MathML one. To alleviate the mentioned issues it may make sense to select the allowed subset of LaTeX - ultimately it's a language for document preparation, not just math rendering, so has much more than necessary to facilitate math chatting.
@Half-Shot This pull request should be compatible with either proposal choice, but tends more towards this one than the other. |
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.
This is not my sphere of knowledge at all, but LaTeX seems like the better of the options.
(matrix-org/matrix-spec-proposals#2191) Firstly, this implements a commonmark-java plugin which is solely used to parse LaTeX input in the composer box, so that they can be rendered into `<span data-mx-maths=...>fallback</span>` and `<div data-mx-maths=...>fallback</div>` for inline and display maths respectively in the sent message. Secondly, received messages of this form are pre-processed by a simple regex into a form which markwon (which performs the rendering) expects.
(matrix-org/matrix-spec-proposals#2191) Firstly, this implements a commonmark-java plugin which is solely used to parse LaTeX input in the composer box, so that they can be rendered into `<span data-mx-maths=...>fallback</span>` and `<div data-mx-maths=...>fallback</div>` for inline and display maths respectively in the sent message. Secondly, received messages of this form are pre-processed by a simple regex into a form which markwon (which performs the rendering) expects.
(matrix-org/matrix-spec-proposals#2191) Firstly, this implements a commonmark-java plugin which is solely used to parse LaTeX input in the composer box, so that they can be rendered into `<span data-mx-maths=...>fallback</span>` and `<div data-mx-maths=...>fallback</div>` for inline and display maths respectively in the sent message. Secondly, received messages of this form are pre-processed by a simple regex into a form which markwon (which performs the rendering) expects.
This may be the wrong place, but what are people's thoughts about blocking this on extensible events? I don't It seems like exactly the sort of thing extensible events and this might provide enough motivation to get that issue resolved, finally. |
While this could definitely make use of extensible events to provide richer fallbacks, I don't want to block this on it. Extensible events are a massive change and this is reasonably trivial. Would rather see this land imperfectly than wait an undefined amount of time behind a major change to the protocol. |
Just to throw in a user perspective: This is a killer feature for users in a university natural sciences setting and the people who would use this, would mostly not care about having to read LaTeX as a fallback since they use it all the time anyways. |
Extensible events is solving a different problem. Extensible events is aimed at the situation where the entire message is some strange new thing, not for when the new thing is part of a message. As an example, suppose that both spoilers and this MSC were implemented using extensible events. How would you send a message that had both a spoiler and math? (e.g. |
I guess I misinterpreted m.message, then. I thought it was an ordered list and that the messages of different types were supposed to be concatenated after rendering.
If I was writing a TUI client, it seems like the above would be easier, as I could just use off the shelf TeX->plaintext and HTML->plaintext rendering libs for each message part and not need to parse html. If my client doesn't support the message type, then it can just use the fallback for that message part. |
Your example did not make the |
Some people write using an odd language that has strange symbols. No, I'm not | ||
talking about computer programmers; I'm talking about mathematicians. In order | ||
to aid these people in communicating, Matrix should define a standard way of | ||
including mathematical notation in messages. |
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 would argue that the vast majority of users will never send mathematical expression to each other. Is the complexity really worth it? LaTeX is non-trivial to parse nor to render.
Also, if Matrix is going to access mathematical notations, what about other domains, like chemistry, physics, … al the myriad of other notations?
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.
Clients aren't required to render or parse the notation, which is why a fallback is present. Several clients do wish to represent mathematical expressions to users though, and having a consistent and standardized way to do so is important.
MSCs for other notations are equally accepted, provided they have similar fallback mechanics.
Is this proposal only limited to LaTeX, or would it also extend to more modern alternatives like Typst? |
This proposal is limited to the expression format of LaTeX, whereas Typst appears to be a full document editor. A separate proposal would be required to express Typst, I believe, as it has a different scope. |
Errr, well, no — Typst is a typsetting language like LaTeX. They do offer a sort of IDE on the side (which functions similaraly to overleaf) to help fund the project. |
The final comment period, with a disposition to merge, as per the review above, is now complete. |
* add proposal for using LaTeX for maths display * rename to match MSC number * change title * update based on feedback * up to clients how to deal with potentially-dangerous commands * fix typo Co-authored-by: Travis Ralston <travpc@gmail.com> * small typo fix --------- Co-authored-by: Travis Ralston <travpc@gmail.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
This proposal states what it is proposing, which is only adding support for the mathematical markup from LaTeX. Any other markup could be proposed in a different proposal. |
spec PR: matrix-org/matrix-spec#1816 |
Merged! 🎉 |
Rendered
This proposal is related to element-hq/element-web#1945, and is a counter-proposal to #1722
Implementations:
FCP tickyboxes