Search code examples
pythonjupyter-notebookmarkdown

Markdown in jupyter-notebook producing only one ouput overwriting the prev. one


I am using jupyter notebook, trying to have a markdown output. This is the minimal example of what I am trying to do (in the original code, the various strings to be print are coming from different functions):

from IPython.display import Markdown as md
md("hello")
md("world")

the output is

world

instead of the expected

hello
world

I really would like to avoid resorting to something like merging the strings as in:

md("hello\nworld")

or passing the different outputs to a file and then read it

Is there any way to achieve this?


Solution

  • Add display

    from IPython.display import Markdown as md
    display(md("hello"))
    display(md("world"))