Nbconvert: markdown fields rendered as `<IPython.core.display.Markdown object>`

Created on 24 Oct 2015  路  3Comments  路  Source: jupyter/nbconvert

The following creates a Markdown-formatted output cell:

example

Viewing the saved .ipynb file shows the following fields in the above cell's outputs fields:

 "data": {
      "text/markdown": [
       "*Markdown*"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
  }

However, when converting the notebook to markdown using nbconvert as

   jupyter nbconvert --execute --to markdown md_output.ipynb --stdout

the cell's output is rendered as <IPython.core.display.Markdown object> (and not as _Markdown_).
This seems similar to issue 7394 for ipython.


In markdown.tpl, the output is rendered by the following block:

{% block data_text scoped %}
{{ output.data['text/plain'] | indent }}
{% endblock data_text %}

A (quick?) workaround is to just override the block by using the following template:

{%- extends 'markdown.tpl' -%}

{% block data_text scoped %}
{{ output.data['text/markdown'] }}
{% endblock data_text %}

(Jupyter 4.0.6)

Most helpful comment

Your notebook is probably loading as untrusted. See the security docs for an explanation of what that means and when a notebook is untrusted.

All 3 comments

This is already fixed in master.

I am on Jupyter 4.2.1 (and Python 3.5), the issue still exists. Opening a saved Jupyter notebook that contained "Markdowns" programatically rendered inline in output cells show up as "" instead of actually rendering as text.

Are there any workarounds I could try?

FWIW I have upgraded to Jupyter 4.4.0 and the issue still remains.
I have the following line in my Jupyter notebook:

display(Markdown('### 1. Loading datasets'))

This shows up as the following when I open the notebook on another host:

The issue is also reported on this Stackoverflow thread: https://stackoverflow.com/questions/46533841/jupyter-notebook-markdown-display-error

Your notebook is probably loading as untrusted. See the security docs for an explanation of what that means and when a notebook is untrusted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bharathgs picture bharathgs  路  5Comments

AllanLRH picture AllanLRH  路  5Comments

milliams picture milliams  路  4Comments

agilly picture agilly  路  5Comments

Carreau picture Carreau  路  4Comments