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

Syntax highlighting hangs when using a substring pattern with ' #2792

Open
kpietak opened this issue Mar 15, 2024 · 2 comments
Open

Syntax highlighting hangs when using a substring pattern with ' #2792

kpietak opened this issue Mar 15, 2024 · 2 comments
Labels

Comments

@kpietak
Copy link

kpietak commented Mar 15, 2024

I have come across a problem with highlighting sections of source code using a pattern/substring (as described in the https://nextra.site/docs/guide/syntax-highlighting#highlighting-substrings documentation).

I am presenting code in Rust that implements lifetimes annotations marked with ' , for example:
fn longer<'a>(a : &'a [i32], b : &'a [i32]) -> &'a [i32].

I am trying to highlight the annotation itself ('a) using the code:

    ```rust /'a/
    fn longer_array<'a>(a : &'a [i32], b : &'a [i32]) -> &'a [i32] {
        ...
    }```

This syntax causes the page rendering to crash (even terminating the process causes the node to remain on).
The question is do we not allow the use of this type of characters in the pattern or is this a bug?

The page rendering is running locally using pnpm dev on macOS.
I would appreciate a reply.

@dimaMachina
Copy link
Collaborator

seems like an upstream issue from rehype-pretty-code (package who add syntax highlighting for code-blocks) https://github.com/rehype-pretty/rehype-pretty-code

Please submit failling test there!

@kpietak
Copy link
Author

kpietak commented Mar 17, 2024

Thank you for a quick reply. I've just created a new issue in retype-pretty-code: rehype-pretty/rehype-pretty-code#185

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

No branches or pull requests

2 participants