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
empty lines at end of certain files cause parse to fail #31
Comments
I think you didn't paste in the exception :-) |
odd, thought I had, here it is: Exception occurred: |
Interesting - I wonder if the empty lines are being treated as a special block by the markdown parser, then failing because they're empty? ping @chrisjsewell since this seemes like something in the bowels of |
I also have had this empty-line issue in some of my notebooks, I now know how to debug it so I've just been fixing it where it's been an issue. If another reproducible example is needed, I could probably create one if it'll help, but I think with the example above, there already be enough info? |
moving this to markdown-it-py |
could some one copy/link here a mininimal example Markdown file where this occurs thanks |
oops - didn't get notified of the above! Thanks @choldgraf @chrisjsewell: Here's an example. There are only two commits in this repo, the first commit without the two blank lines (works fine), and the second commit with the two blank lines (build fails).
P.S. @poldrack I created a template jupyterbook, and replaced the content of |
For what it's worth, I couldn't reproduce the issue with any old md file by adding two blank lines, only certain files. |
Hi, I took a quick look at this. When processing lists, there is a call to tokenize() that advances the state.line attribute :
After this line is executed, state.line can be larger than endLine, leading to the IndexError when checking the state at that index. Breaking right after this line if state.line > endLine doesn't work though, we have to update the
The easy solution would be to just put the check a few lines earlier.
Also, I'm not sure about what itemLines does, it's not really used at all in this method. I can't run the test suite right now to check that this solution doesn't break anything else. But a diff on spec.md shows no difference. If no one else writes the fix (feel free to do it), I'll do it this evening or tomorrow. Edit: also, maybe there is a more elegant solution to implement in the tokenize() method. |
…list and several empty lines fails
Describe the bug
The presence of three empty lines at the end of a particular file causes the build to break.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When the extra lines are added, the follow Exception occurs:
Environment
Python 3.8.3
output of
jupyter-book --version
:Jupyter Book: 0.7.3
MyST-NB: 0.8.4
Sphinx Book Theme: 0.0.33
MyST-Parser: 0.9.0
Jupyter-Cache: 0.2.2
Operating System: Mac OS X
The text was updated successfully, but these errors were encountered: