Skip to content
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

Enable lossless markdown editing with Extensible Events #1493

Open
ShadowJonathan opened this issue Jan 2, 2022 · 0 comments
Open

Enable lossless markdown editing with Extensible Events #1493

ShadowJonathan opened this issue Jan 2, 2022 · 0 comments
Labels
A-Composer A-Message-Editing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Enhancement T-Task Tasks for the team like planning X-Needs-Product More input needed from the Product team X-Spec-Changes

Comments

@ShadowJonathan
Copy link

Your use case

With MSC1767, it is now possible to represent events in more formats than plain + HTML, this would enable also sending/setting the raw markdown into the event itself, as it's being sent out;

{
    "type": "m.message",
    "content": {

        "m.message": [
            {
                "mimetype": "text/html",
                "body": "i am a <b>fish</b>"
            },
            {
                "mimetype": "text/x-markdown",
                "body": "i am a *fish*"
            },
            {
                "mimetype": "text/plain",
                "body": "i am a *fish*"
            }
        ],
    }
}

Or alternatively (with an MSC);

{
    "type": "m.message",
    "content": {

        "m.text": "i am a *fish*",
        "m.md": "i am a *fish*",
        "m.html": "i am a <b>fish</b>"
    }
}

This would preserve the markdown perfectly, and allow seamless editing without a long tail of lossy html-to-markdown conversion errors (such as element-hq/element-web#12535, element-hq/element-web#17242, etc.)

This would fix element-hq/element-web#10725

This would be extra duplication per message, but until/unless the matrix ecosystem as a whole goes off of HTML, this is unavoidable.

This solution would allow some compatible viewing of events, but an edit of a non-markdown-aware client on such an event like this would still make a lossy conversion of the HTML, instead of using the markdown in full.

Have you considered any alternatives?

Immediate jump to GFM (#330) while speccing the GFM ExtEv keys as well;

The above, but GFM
{
    "type": "m.message",
    "content": {

        "m.message": [
            {
                "mimetype": "text/html",
                "body": "i am a <b>fish</b>"
            },
            {
                "mimetype": "text/x-gfm",
                "body": "i am a *fish*"
            },
            {
                "mimetype": "text/plain",
                "body": "i am a *fish*"
            }
        ],
    }
}

Or alternatively;

{
    "type": "m.message",
    "content": {
        "m.text": "i am a *fish*",
        "m.gfm": "i am a *fish*",
        "m.html": "i am a <b>fish</b>"
    }
}

Additional context

No response

@kittykat kittykat added A-Message-Editing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Task Tasks for the team like planning A-Composer labels Jan 2, 2022
@robintown robintown added the X-Needs-Product More input needed from the Product team label Mar 8, 2022
@t3chguy t3chguy transferred this issue from element-hq/element-web Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Composer A-Message-Editing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Enhancement T-Task Tasks for the team like planning X-Needs-Product More input needed from the Product team X-Spec-Changes
Projects
None yet
Development

No branches or pull requests

4 participants