✨ NEW: Do not allow blank lines within $$#8
Conversation
This matches the behavior of LaTeX, and prevents runaway parsing if a $$ is opened but not closed.
|
@eric-wieser, I fixed up the linting and the formatting in one test, but it looks like there is an issue with: Which I believe should still work. Maybe this is just the label part? |
|
That test is from Right? |
src/index.ts
Outdated
| end = state.eMarks[nextLine] | ||
| if (end - start < 2) { | ||
| continue | ||
| break // blank lines are not allowed within $$ |
There was a problem hiding this comment.
This logic is wrong, it fails on lines consisting of a single character. I think I assumed that \n was counted in the total.
There was a problem hiding this comment.
I think the entire if can be safely removed, as the new if replaces it
There was a problem hiding this comment.
That does fix the tests. I will push and then get a sanity check from @chrisjsewell.
There was a problem hiding this comment.
Any update on this? I'd like to port a documentation tool for the Lean programming language from using mistletoe to useing markdown-it, but can't do so without this fix!
There was a problem hiding this comment.
I haven't heard from @chrisjsewell in the last week. I did ping him on slack. I unfortunately don't have npm admin rights to update this at the moment.
Co-authored by: @eric-wieser
rowanc1
left a comment
There was a problem hiding this comment.
This moves the if statement based on empty text rather than a token length, which is a bit more robust to other cases, which are now added.
Looks all good from my perspective and passes tests!
|
Thanks for your contribution here @eric-wieser! |
|
Seems reasonable, but should also be pushed to https://github.com/executablebooks/mdit-py-plugins/blob/master/mdit_py_plugins/dollarmath/index.py |
|
Is that something you port manually, or something that these is a script to port? |
|
Heya, no just manually |
|
@rowanc1, would you be able to take a look at executablebooks/mdit-py-plugins#46? I was hoping to use this from python, but the two versions are still not in sync. |
|
Looks like it just needs a deploy, right?! Yep I can test it and get it out! 🚀 |
|
Oh, I see looks like you need the merge in the python side -- @chrisjsewell any chance that you can give this a bit of attention or guidance on how to bring it in? |
From @eric-wieser: