Make output cells like Markdown

前端 未结 3 1886
故里飘歌
故里飘歌 2020-12-31 04:09

I like IPython\'s Markdown cells for incorporating HTML and other rich content inside notebooks. I would like to know if a command output can be formatted similarly, in outp

3条回答
  •  [愿得一人]
    2020-12-31 05:00

    A somehow more advanced solution was recently published in a blog post here:

    http://guido.vonrudorff.de/ipython-notebook-code-output-as-markdown/

    It creates and registers a new IPython magic %%asmarkdown. The output of each code cell which you prepend with this command will be rendered like pure markdown cells. Using the content of the original question, the following would behave as expected:

    %%asmarkdown
    print """
    

    Matplotlib's chart gallery (Click a chart to see the code to create it)


    """

提交回复
热议问题