Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Disallow inline display maths#5939

Merged
uhoreg merged 1 commit intomatrix-org:developfrom
rda0:disallow-inline-diplay-maths
Apr 29, 2021
Merged

Disallow inline display maths#5939
uhoreg merged 1 commit intomatrix-org:developfrom
rda0:disallow-inline-diplay-maths

Conversation

@rda0
Copy link
Copy Markdown
Contributor

@rda0 rda0 commented Apr 28, 2021

This fixes element-hq/element-web#17095 by changing the default regex for display maths to only parse display maths when it starts and ends on a new line.

I believe this is acceptable since display maths will be rendered using the full page width anyway.

The default behavior in config.json can now be reproduced as follows:

    "latex_maths_delims": {
        "inline": {
            "left": "\\(",
            "right": "\\)",
            "pattern": {
                "latex": "(^|[^\\\\])\\\\\\((?!\\\\\\))(.*?)\\\\\\)",
                "tex": "(^|\\s|[.,!?:;])(?!\\\\)\\$(?!\\s)(([^$\\n]|\\\\\\$)*([^\\\\\\s\\$]|\\\\\\$)(?:\\\\\\$)?)\\$"
            }
        },
        "display": {
            "left": "\\[",
            "right": "\\]",
            "pattern": {
                "latex": "(^)\\\\\\[(?!\\\\\\])(.*?)\\\\\\]$",
                "tex": "(^)\\$\\$(([^$]|\\\\\\$)+?)\\$\\$$"
            }
        }
    },

@turt2live turt2live requested a review from a team April 28, 2021 18:10
@uhoreg uhoreg merged commit 11ee3c7 into matrix-org:develop Apr 29, 2021
@rda0 rda0 deleted the disallow-inline-diplay-maths branch April 30, 2021 08:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LaTeX parsing: display math in inline code blocks mangles message

2 participants