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

LaTeX parsing: display math in inline code blocks mangles message #17095

Closed
rda0 opened this issue Apr 28, 2021 · 0 comments · Fixed by matrix-org/matrix-react-sdk#5939
Closed
Assignees
Labels
A-Maths Render LaTeX maths in messages T-Defect

Comments

@rda0
Copy link
Contributor

rda0 commented Apr 28, 2021

Using display maths ($$...$$ or \[...\]) in inline code blocks will result in a highly mangled message. I think it also happens for indented code blocks.

Example:

- Uses LaTeX and TeX delimiters by default. (Delimiters for inline math are `\(...\)` / `$...$` and for display math `\[...\]` / `$$...$$`)
- Multi-line inline maths using `$...$` is not allowed anymore, use `\(...\)` instead
- There must be no spaces around inline TeX style notation, good: `$\TeX$`, bad: `$ \TeX $`
- Editing existing messages will use LaTeX style delimiters

Result:

image

It can be fixed by adjusting the regex for display maths slightly, to only parse display maths when it starts on a new line. I believe this is acceptable since display maths will be rendered using the full page width anyway.

I will make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Maths Render LaTeX maths in messages T-Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants