-
Notifications
You must be signed in to change notification settings - Fork 5
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
✨ 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
@@ -304,14 +304,17 @@ function math_block_dollar( | |||
start = state.bMarks[nextLine] + state.tShift[nextLine] | |||
end = state.eMarks[nextLine] | |||
if (end - start < 2) { | |||
continue | |||
break // blank lines are not allowed within $$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the entire if
can be safely removed, as the new if replaces it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does fix the tests. I will push and then get a sanity check from @chrisjsewell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: