I have the following in a Jupyter notebook cell:
import IPython.display as display
s = '# The World at Large'
display.display(display.Markdown(s))
s = '<b> The World at Large</b>'
display.display(display.HTML(s))
If I run it with shift+enter on the keyboard, I get:
However, if I execute the notebook with
jupyter nbconvert --execute --to notebook --inplace <notebook.ipynb>
I get:
How do I get the Markdown to display like in the first image using nbconvert?
After you run
jupyter nbconvert --execute
, your notebook is in an 'untrusted' state, which I believe is the cause of the issue you're describing. You can explicitly trust the notebook by runningjupyter trust <notebook.ipynb>
, which will allow your markdown output to render as expected.See also the official docs on security, and this nbconvert issue on GitHub.