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

Mermaid Syntax Error in text on mdbook highlight #42

Open
anistark opened this issue Mar 29, 2024 · 3 comments
Open

Mermaid Syntax Error in text on mdbook highlight #42

anistark opened this issue Mar 29, 2024 · 3 comments

Comments

@anistark
Copy link

Mermaid diagram is failing on mdbook search.

How to reproduce:

Search anything on mdbook that matches the texts inside mermaid diagram. It fails with said message.

Screenshot 2024-03-29 at 3 37 59 PM

Possible keyword clashes between query param highlight

@badboy
Copy link
Owner

badboy commented Apr 2, 2024

Highlighting is done client-side in JS. It inserts some additional HTML around the words to highlight.
The mermaid code is still in the HTML and the highlighter runs before mermaid.js.
There's really not much we can do here.

@anistark
Copy link
Author

anistark commented Apr 2, 2024

@badboy any way to avoid it ? Like disable highlight in mermaid?

@badboy
Copy link
Owner

badboy commented Apr 2, 2024

The highlighting is done in mdbook's JavaScript here: https://github.com/rust-lang/mdBook/blob/bd323fb930eaadff4e8ee3859b064731617fd875/src/theme/searcher/searcher.js#L298-L315

I don't know how it works. Maybe mark_exclude can be a list of things?
It's always set to the empty list though, so you would either need to modify that file and deploy it or find a way to inject your own configuration before it runs.
Alternatively figure out a way for mermaid.js to run before the searcher.js does its job.

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

No branches or pull requests

2 participants