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

First Newline becomes <br>, even in code block #97

Open
HarHarLinks opened this issue Nov 8, 2021 · 1 comment
Open

First Newline becomes <br>, even in code block #97

HarHarLinks opened this issue Nov 8, 2021 · 1 comment

Comments

@HarHarLinks
Copy link

HarHarLinks commented Nov 8, 2021

sending data like

"text": "<pre><code>{\n    \"another\": [\n        \"contains\",\n        \"a\",\n        \"list\"\n    ],\n    \"payload\": \"testing\"\n}\n</code></pre>\n",
"format": "html",

(yes that's pretty printed json as the body)
results in (element view source)

"content": {
    "body": "{    \"another\": [\n        \"contains\",\n        \"a\",\n        \"list\"\n    ],\n    \"payload\": \"testing\"\n}\n\n",
    "msgtype": "m.text",
    "format": "org.matrix.custom.html",
    "formatted_body": "<pre><code>{<br>    \"another\": [\n        \"contains\",\n        \"a\",\n        \"list\"\n    ],\n    \"payload\": \"testing\"\n}\n</code></pre>\n"
  },

noticably the first \n in the original message is dropped/converted.

@HarHarLinks HarHarLinks changed the title Newline in code block becomes <br> First Newline becomes <br>, even in code block Dec 23, 2021
@HarHarLinks
Copy link
Author

I have worked around this in my downstream project, including some explanation of what goes wrong
HarHarLinks/matrix-webhook-receiver@d26bd4c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant