Skip to content

Wrong display math syntax highlighting and preview #703

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

Open
memeplex opened this issue May 6, 2025 · 1 comment
Open

Wrong display math syntax highlighting and preview #703

memeplex opened this issue May 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@memeplex
Copy link

memeplex commented May 6, 2025

Bug description

$$x$$

is being highlighted as:

Image

and in the preview looks like:

Image

This is just an example. Any display math block will fail in similar ways.

Steps to reproduce

Create a qmd file with the content above. Open the math preview.

Actual behavior

As shown above.

Expected behavior

The block is correctly recognized and presented as display math.

Your environment

  • IDE: VSCode 1.99.3
  • macOS Sequoia 15.1
  • Quarto Extension 1.121.0
@memeplex memeplex added the bug Something isn't working label May 6, 2025
@memeplex
Copy link
Author

memeplex commented May 6, 2025

I believe the problem is in the syntax definition:

  math_inline:
    name: markup.math.inline.quarto
    match: '(?<=\s|\W|^)(?<!\$)(\$)(.+?)(\$)(?!\$)(?=\s|\W|$)'

Here a potential extern $...$ pair is excluded but nothing is preventing the intern pair to be taken as part of the content itself, which is indeed what ends up happening, as it's easy to check using the token and scopes inspector. I guess the inner group should be replaced by something like ([^$]+?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant