-
Notifications
You must be signed in to change notification settings - Fork 0
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
Gracefully handle invalid bibtex #3
Comments
Hi @chfritz, Thanks for the report and the minimal example. I tried to reproduce locally, but unfortunately I cannot. I tried two approaches:
In both cases, the rendering seemed to terminate and the output looks okay to me: Here is a link to the JSFiddle playground: https://jsfiddle.net/tgk8v29u/ I tried the above with PrismJS versions 1.23.0 (last tested version for this plugin) and 1.29.0 (current latest version). Please let me know more about your environment. If you could provide a link to your page where this issue occurs, that would also be super helpful. |
Ah, correction, the error happens when typing the next character. I'm able to reproduce it in the jsfiddle you provided -- very helpful, thanks! -- when using this:
|
simplified quoted-strings pattern, fixed 4-level nested brace matching (see: #3), fixed `=` sign in front of field values being included in value `string`
Thanks again @chfritz! I was able to reproduce the bug and was able to fix it. While at it, I pushed a few other simplifications & minor fixes as well. Please see the working example at https://saswat.padhi.me/prismjs-bibtex/broken.html -- shouldn't hang your browser :) Closing this issue, but please feel free to reopen if this hasn't been adequately resolved. Thanks and regards. |
Confirmed. Thanks so much for the quick fix! |
First off, thanks a lot for this great prism extension! I've been using it in an online bibtex editor context and it's been working great for the most part, however I've noticed that it sometimes hangs itself when trying to parse invalid bibtex, which of course happens a lot during editing.
I've been able to reliably reproduce this by starting a bibtex file with:
Somehow, at this particular moment in editing, the plugin appears to go into an infinite loop, because the tab's CPU goes to 100% and freezes completely.
Any idea whether this can be fixed? Simply punting and giving up would be fine in my context (i.e., only highlight when valid).
The text was updated successfully, but these errors were encountered: