-
Notifications
You must be signed in to change notification settings - Fork 132
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
Unexpected behaviour when a notebook is not valid JSON #374
Comments
I'm very happy to implement a change to nbsphinx myself, if need be, once the maintainers have decided on the right course. |
Thanks for the report! This is actually known behavior but I'm aware that it's a bit unfortunate. The reason why this is not an error is that the See the docstring: Lines 822 to 832 in aad12aa
... and this issue + PR: #154 + #156
If you find a reliable way to detect that a given string is not intended as a reST (or in the future probably a Markdown) string, we could probably raise a combined There has also been a bit of a discussion on the Sphinx-dev mailing list: https://groups.google.com/d/topic/sphinx-dev/PvAQfZcDeHw/discussion I think ideally Sphinx would create a separate API for translating paragraphs, then this problem would immediately go away. But I don't know whether that will happen anytime soon (or at all). |
As a work-around, you could turn Sphinx warnings into errors with It is quite likely that a garbled JSON file will cause quite a few warnings. It most definitely does in this case. I'm normally using |
Ah thanks for the explanations. That makes sense. I'd read that part of the docstring, but I hadn't quite figured how it applied to my issue. Thanks for the suggestion of using |
Thanks for nbsphinx. It's great!
When a notebook is not valid JSON, the JSON source gets directly rendered to HTML.
As far as I can tell, this behaviour arises here: if the default converter fails for any reason, nbsphinx falls back silently to the RST Parser. The RST Parser seems to just convert the content, broken JSON and all, to HTML.
Unless I'm missing something, I'd expect nbsphinx to fail if it fails to parse the notebook?
I've created a minimal repository demonstrating this here. With this, the rendered HTML looks like:
This tripped us up in ipywidgets when a notebook became invalid JSON as a result of a merge conflict. Reported in this issue.
The text was updated successfully, but these errors were encountered: