Skip to content

An md file, or notebook cell, ending in a blockquote with a blank line, causes a crash #185

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

Closed
fperez opened this issue Jan 24, 2022 · 9 comments · Fixed by #186
Closed
Labels
bug Something isn't working

Comments

@fperez
Copy link

fperez commented Jan 24, 2022

Describe the bug

Consider a notebook that contains the following cell:

> test
>

or a markdown file with the above. The key point is that the cell/markdown content must end with a blockquote that has a blank line at the end, still part of the block quote. The python short traceback is (I'll attach the long one):

Exception occurred:
  File "/Users/fperez/local/conda/lib/python3.9/site-packages/markdown_it/rules_block/blockquote.py", line 158, in blockquote
    if state.srcCharCode[pos] == 0x20:  # /* space */
IndexError: tuple index out of range

Reproduce the bug

Running a build with a notebook with the above (or an md file) should suffice.

List your environment

> jupyter-book --version
Jupyter Book      : 0.11.3
External ToC      : 0.2.3
MyST-Parser       : 0.13.7
MyST-NB           : 0.12.3
Sphinx Book Theme : 0.1.10
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.10
@fperez fperez added the bug Something isn't working label Jan 24, 2022
@welcome
Copy link

welcome bot commented Jan 24, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@fperez
Copy link
Author

fperez commented Jan 24, 2022

Full Sphinx error log:

sphinx-err-06zb0e7h.log

@fperez
Copy link
Author

fperez commented Jan 24, 2022

@facusapienza21 - note this - Lab 1 for S159 was causing this crash and it took me a while to track down the issue. Since it's a bug in markdown-it upstream, for now we can work around it by adding an extra blank line in cells that have block quotes, but I wanted you to be aware so you don't burn time on it...

fperez added a commit to UCB-stat-159-s22/site that referenced this issue Jan 24, 2022
Also made some edits to block quotes to work around this bug in markdown-it-py:
executablebooks/markdown-it-py#185
@hukkin
Copy link
Contributor

hukkin commented Jan 24, 2022

Since it's a bug in markdown-it upstream

To clarify, I don't think this is an issue in upstream Javascript markdown-it, but rather a porting issue in markdown-it-py.

I've fixed this in #186

@chrisjsewell
Copy link
Member

Heya, yeh thanks, it is indeed a porting issue that I thought we had fully fixed already 😳.
Basically, for array[outofbounds_index] JS returns null (thus no crash) but Python raises an IndexError

@fperez
Copy link
Author

fperez commented Jan 24, 2022

Thanks folks for the super-quick response! And yes @hukkin - I meant markdown-it-py, sorry for being imprecise in the js/py distinction :)

I greatly appreciate the quick fix, we'll roll it out into our working image once it's part of the next release.

@chrisjsewell
Copy link
Member

cheers!
(FYI, in case you didn't notice, jupyter-book/jupyter-book#1181 was closed with jupyter-book v0.12)

@fperez
Copy link
Author

fperez commented Jan 24, 2022

Awesome - I hadn't noticed the 1181 fix, but that's much appreciated!

@chrisjsewell
Copy link
Member

chrisjsewell commented Jan 24, 2022

It's been hanging around at this "level" for a while, just had to float its way up to jupyter-book lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants