element-hq / element-hq/element-web
Katex breaks codeblock
- Dominant language
- TypeScript
- Stars
- 13.5k
- Forks
- 2.8k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
1. Enable Latex Rendering
2. Have an event like this:
```
{
"content": {
"body": "TWIM: The following update is pre-formatted as Markdown for your convenience.\n\n#+begin_src markdown\nTWIM: [Ement.el](https://github.com/alphapapa/ement.el), a Matrix client for the [GNU Emacs](https://www.gnu.org/software/emacs/) text editor and Lisp machine, has been released at v0.10. Changes include:\n\n**Security Fixes**\n\n- When uploading a GPG-encrypted file (i.e. one whose filename ends in `.gpg`), if the recipient's private key or the symmetric encryption key were cached by Emacs (or a configured agent, like `gpg-agent`), Emacs would automatically decrypt the file while reading its contents and then upload the decrypted contents. (This happened because the function `insert-file-contents` was used, which does many things automatically, some of which are not even mentioned in its docstring; refer to its entry in the Elisp Info manual for details. The fix is to use `insert-file-contents-literally` instead.) Thanks to `@welkinsl:matrix.org` for reporting.\n\n**Additions**\n\n- Support for Single Sign-On (SSO) authentication. ([#24](https://github.com/alphapapa/ement.el/issues/24). Thanks to [Jeffrey Stoffers](https://github.com/Necronian) for development, and to [Phil Sainty](https://github.com/phil-s), [Jakub Kadlčík](https://github.com/FrostyX), and [Juanjo Presa](https://github.com/oneingan) for testing.)\n- Bind `m` in room buffers to `ement-room-mark-read` (which moves read markers to point).\n\n**Changes**\n\n- Activating a space in the room list uses `ement-view-space` (which shows a directory of rooms in the space) instead of `ement-view-room` (which shows events in the space, which is generally not useful).\n- Command `ement-view-room`, when used for a space, shows a footer explaining that the buffer is showing a space rather than a normal room, with a button to call `ement-view-space` for it (which lists rooms in the space).\n- Command `ement-describe-room` shows whether a room is a space or a normal room.\n- Command `ement-view-space` shows the space's name and alias.\n- Command `ement-room-scroll-up-mark-read` moves the fully read marker to the top of the window (when the marker's position is within the range of known events), rather than only moving it when at the end of the buffer. (This eases the process of gradually reading a long backlog of messages.)\n- Improve readme export settings.\n\n**Fixes**\n\n- Extra indentation of some membership events. (Thanks to [Steven Allen](https://github.com/Stebalien).)\n- Customization group for faces.\n- Don't reinitialize `ement-room-list-mode` when room list buffer is refreshed. ([#146](https://github.com/alphapapa/ement.el/issues/146). Thanks to [Ted Reed](https://github.com/treed) for reporting.)\n- Don't fetch old events when scrolling to the bottom of a room buffer (only when scrolling to the top). (Thanks to [Steven Allen](https://github.com/Stebalien).)\n- Minor improvements to auto-detection of homeserver URIs. (See [#24](https://github.com/alphapapa/ement.el/issues/24#issuecomment-1569518713). Thanks to [Phil Sainty](https://github.com/phil-s).)\n- Uploading of certain filetypes (e.g. Emacs would decompress some archives before uploading). Thanks to `@welkinsl:matrix.org` for reporting.\n- Messages edited multiple times sometimes weren't correctly replaced.\n\nFeel free to join us in the chat room, [#ement.el:matrix.org](https://matrix.to/#/#ement.el:matrix.org).\n#+end_src",
"format": "org.matrix.custom.html",
"formatted_body": "
\nTWIM: The following update is pre-formatted as Markdown for your convenience.\n
\n\nTWIM: [Ement.el](https://github.com/alphapapa/ement.el), a Matrix client for the [GNU Emacs](https://www.gnu.org/software/emacs/) text editor and Lisp machine, has been released at v0.10. Changes include:\n\n**Security Fixes**\n\n- When uploading a GPG-encrypted file (i.e. one whose filename ends in `.gpg`), if the recipient's private key or the symmetric encryption key were cached by Emacs (or a configured agent, like `gpg-agent`), Emacs would automatically decrypt the file while reading its contents and then upload the decrypted contents. (This happened because the function `insert-file-contents` was used, which does many things automatically, some of which are not even mentioned in its docstring; refer to its entry in the Elisp Info manual for details. The fix is to use `insert-file-contents-literally` instead.) Thanks to `@welkinsl:matrix.org` for reporting.\n\n**Additions**\n\n- Support for Single Sign-On (SSO) authentication. ([#24](https://github.com/alphapapa/ement.el/issues/24). Thanks to [Jeffrey Stoffers](https://github.com/Necronian) for development, and to [Phil Sainty](https://github.com/phil-s), [Jakub Kadlčík](https://github.com/FrostyX), and [Juanjo Presa](https://github.com/oneingan) for testing.)\n- Bind `m` in room buffers to `ement-room-mark-read` (which moves read markers to point).\n\n**Changes**\n\n- Activating a space in the room list uses `ement-view-space` (which shows a directory of rooms in the space) instead of `ement-view-room` (which shows events in the space, which is generally not useful).\n- Command `ement-view-room`, when used for a space, shows a footer explaining that the buffer is showing a space rather than a normal room, with a button to call `ement-view-space` for it (which lists rooms in the space).\n- Command `ement-describe-room` shows whether a room is a space or a normal room.\n- Command `ement-view-space` shows the space's name and alias.\n- Command `ement-room-scroll-up-mark-read` moves the fully read marker to the top of the window (when the marker's position is within the range of known events), rather than only moving it when at the end of the buffer. (This eases the process of gradually reading a long backlog of messages.)\n- Improve readme export settings.\n\n**Fixes**\n\n- Extra indentation of some membership events. (Thanks to [Steven Allen](https://github.com/Stebalien).)\n- Customization group for faces.\n- Don't reinitialize `ement-room-list-mode` when room list buffer is refreshed. ([#146](https://github.com/alphapapa/ement.el/issues/146). Thanks to [Ted Reed](https://github.com/treed) for reporting.)\n- Don't fetch old events when scrolling to the bottom of a room buffer (only when scrolling to the top). (Thanks to [Steven Allen](https://github.com/Stebalien).)\n- Minor improvements to auto-detection of homeserver URIs. (See [#24](https://github.com/alphapapa/ement.el/issues/24#issuecomment-1569518713). Thanks to [Phil Sainty](https://github.com/phil-s).)\n- Uploading of certain filetypes (e.g. Emacs would decompress some archives before uploading). Thanks to `@welkinsl:matrix.org` for reporting.\n- Messages edited multiple times sometimes weren't correctly replaced.\n\nFeel free to join us in the chat room, [#ement.el:matrix.org](https://matrix.to/#/#ement.el:matrix.org).\n\n"msgtype": "m.text"
},
"origin_server_ts": 1686769714311,
"sender": "@alphapapa:matrix.org",
"type": "m.room.message",
"unsigned": {},
"event_id": "$z31FDnow6zxcjWuqvjOYzdOpPMdhKehgARfNF2zP5Tk",
"room_id": "!QQpfJfZvqxbCfeDgCj:matrix.org"
}
```
( https://matrix.to/#/!QQpfJfZvqxbCfeDgCj:matrix.org/$z31FDnow6zxcjWuqvjOYzdOpPMdhKehgARfNF2zP5Tk?via=matrix.org&via=element.io&via=envs.net )
### Outcome
#### What did you expect?
A codeblock:

#### What happened instead?

And katex rendering in the DOM:

### Operating system
Fedora Silverblue 38
### Browser information
Firefox 114.0 (64-bit)
### URL for webapp
develop.element.io
### Application version
Version von Element: 37203d193a34-react-4243847f4f70-js-0545f6df096a Version von Olm: 3.2.14
### Homeserver
matrix.midnightthoughts.space
### Will you send logs?
No
Contributor guide
Assessment
This issue has not been assessed yet.