-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Exponential-time parsing for non-closed fenced divs #9635
Comments
Section titles inside divs are okay. But perhaps the auto-close behavior would be sensible. Note that |
I also don't mind the current semantics, but the exponential behaviour is a problem. It took me several hours to understand why Pandoc all of a sudden became so slow, until I found out I had accidentally removed some closing divs |
Agreed. I think I will implement the auto-close behavior (along with a warning). |
New behavior with the above script:
|
Wow that was quick! 🙏🙏 |
Just a curious question: what’s the rule now for autoclose? I tried to read your code… does it autoclose when it encounters a new fenced div on the same level? (The same or fewer number of “:”s?) |
It will auto-close in exactly the situations where previously it would have given up parsing as a div and backtracked. So, not when it encounters a new fenced div on the same level. It will accept this as a nested div (as before). |
Pandoc version?
3.1.12.3
Explain the problem
If you accidentally forget to close a fenced div, the parser becomes extremely slow. Here's a minmal example:
On my computer I get this:
Solution suggestion
Any of these two should be fine:
Yes, sometimes you want section titles within a fenced div, but many times not. So perhaps a new cmd-line option where you can say how to handle nested fenced divs / sections. Perhaps a maximum nesting depth?
The text was updated successfully, but these errors were encountered: