nbconvert crashes when faced with blank items in a bulleted list #7929

Closed
jdavidheiser opened this Issue Mar 2, 2015 · 8 comments

Comments

Projects
None yet
3 participants
@jdavidheiser
Contributor

jdavidheiser commented Mar 2, 2015

The following linked gist of an extremely simple notebook crashes nbconvert

https://gist.github.com/jdavidheiser/d1dd25c7822d265c7e0b

This could be a bug in mistune instead of in ipython - I haven't dug deeply into how the Markdown to be rendered is getting passed around.

The error text is as follows:

[NbConvertApp] Converting notebook nbconvert-crash.ipynb to html
[NbConvertApp] Support files will be in nbconvert-crash_files/
[NbConvertApp] Loaded template full.tpl
Traceback (most recent call last):
  File "/opt/anaconda3/bin/ipython3", line 9, in <module>
    load_entry_point('ipython==3.0.0-rc1', 'console_scripts', 'ipython3')()
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/__init__.py", line 120, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/config/application.py", line 574, in launch_instance
    app.start()
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 367, in start
    return self.subapp.start()
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/nbconvertapp.py", line 261, in start
    self.convert_notebooks()
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/nbconvertapp.py", line 300, in convert_notebooks
    output, resources = exporter.from_filename(notebook_filename, resources=resources)
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/exporter.py", line 153, in from_filename
    return self.from_notebook_node(nbformat.read(f, as_version=4), resources=resources, **kw)
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/html.py", line 57, in from_notebook_node
    return super(HTMLExporter, self).from_notebook_node(nb, resources, **kw)
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/templateexporter.py", line 214, in from_notebook_node
    output = self.template.render(nb=nb_copy, resources=resources)
  File "/opt/anaconda3/lib/python3.4/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/opt/anaconda3/lib/python3.4/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/anaconda3/lib/python3.4/site-packages/jinja2/_compat.py", line 36, in reraise
    raise value.with_traceback(tb)
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/html/full.tpl", line 2, in <module>
    {% from 'mathjax.tpl' import mathjax %}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/html/basic.tpl", line 1, in <module>
    {%- extends 'display_priority.tpl' -%}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/skeleton/display_priority.tpl", line 1, in <module>
    {%- extends 'null.tpl' -%}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/skeleton/null.tpl", line 26, in <module>
    {%- block body -%}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/html/full.tpl", line 63, in <module>
    {{ super() }}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/skeleton/null.tpl", line 28, in <module>
    {%- block any_cell scoped -%}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/skeleton/null.tpl", line 72, in <module>
    {%- block markdowncell scoped-%}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/exporters/../templates/html/basic.tpl", line 76, in <module>
    {{ cell.source  | markdown2html | strip_files_prefix }}
  File "/opt/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/filters/markdown.py", line 166, in markdown2html_mistune
    return MarkdownWithMath(renderer=IPythonRenderer()).render(source)
  File "mistune.py", line 927, in mistune.Markdown.render (mistune.c:18685)
  File "mistune.py", line 930, in mistune.Markdown.parse (mistune.c:19057)
  File "mistune.py", line 972, in mistune.Markdown.output (mistune.c:19784)
  File "mistune.py", line 190, in mistune.BlockLexer.__call__ (mistune.c:3345)
  File "mistune.py", line 209, in mistune.BlockLexer.parse (mistune.c:3840)
  File "mistune.py", line 204, in mistune.BlockLexer.parse.manipulate (mistune.c:3661)
  File "mistune.py", line 264, in mistune.BlockLexer.parse_list_block (mistune.c:5171)
  File "mistune.py", line 302, in mistune.BlockLexer._process_list_item (mistune.c:5849)
  File "mistune.py", line 209, in mistune.BlockLexer.parse (mistune.c:3840)
  File "mistune.py", line 204, in mistune.BlockLexer.parse.manipulate (mistune.c:3661)
  File "mistune.py", line 264, in mistune.BlockLexer.parse_list_block (mistune.c:5171)
  File "mistune.py", line 291, in mistune.BlockLexer._process_list_item (mistune.c:5730)
IndexError: string index out of range
@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 2, 2015

Member

Might be a bug in mistune. Can you (or someone) try that snippet of markdown in the mistune API?

Ping @lepture

Member

takluyver commented Mar 2, 2015

Might be a bug in mistune. Can you (or someone) try that snippet of markdown in the mistune API?

Ping @lepture

@jdavidheiser

This comment has been minimized.

Show comment
Hide comment
@jdavidheiser

jdavidheiser Mar 2, 2015

Contributor

I confirmed that the same error is thrown when the same markdown is input directly into mistune.

Contributor

jdavidheiser commented Mar 2, 2015

I confirmed that the same error is thrown when the same markdown is input directly into mistune.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 3, 2015

Member

Thanks - do you want to file an issue at https://github.com/lepture/mistune/issues

Member

takluyver commented Mar 3, 2015

Thanks - do you want to file an issue at https://github.com/lepture/mistune/issues

@lepture lepture referenced this issue in lepture/mistune Mar 3, 2015

Closed

IPython refer #43

lepture added a commit to lepture/mistune that referenced this issue Mar 4, 2015

@lepture

This comment has been minimized.

Show comment
Hide comment

lepture commented Mar 4, 2015

Fixed in this commit: lepture/mistune@fd8c175

@takluyver takluyver added the nbconvert label Mar 4, 2015

@takluyver takluyver added this to the no action milestone Mar 4, 2015

@takluyver

This comment has been minimized.

Show comment
Hide comment
Member

takluyver commented Mar 4, 2015

Thanks @lepture

@takluyver takluyver closed this Mar 4, 2015

thorstenb added a commit to thorstenb/odpdown that referenced this issue Mar 8, 2015

Fix tests.
Was hitting ipython/ipython#7929 with the
test_empty_list_items_page test. And newer pep8 syntax checker was
more strict.
@lepture

This comment has been minimized.

Show comment
Hide comment
@lepture

lepture Mar 10, 2015

@takluyver 0.5.1 was released.

lepture commented Mar 10, 2015

@takluyver 0.5.1 was released.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Mar 10, 2015

Member

Thanks!

Member

takluyver commented Mar 10, 2015

Thanks!

@jdavidheiser

This comment has been minimized.

Show comment
Hide comment
@jdavidheiser

jdavidheiser Mar 10, 2015

Contributor

thanks to both of you for investigating and fixing this so quickly!

Contributor

jdavidheiser commented Mar 10, 2015

thanks to both of you for investigating and fixing this so quickly!

@pyup-bot pyup-bot referenced this issue in rochacbruno/flasgger Jul 18, 2016

Closed

Initial Update #30

@pyup-bot pyup-bot referenced this issue in rochacbruno/quokka Feb 6, 2018

Closed

Pin mistune to latest version 0.8.3 #547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment