Format output of code cell with Markdown

泪湿孤枕 提交于 2020-06-10 02:15:40

问题


Output of Python code cell seems to be not processed by Markdown.

For example in Python code cell there could be something like that:

print "**bold**"

And the output is: **bold** instead of bold. Is there a way to make it really bold?


回答1:


To get markdown formatted output, you can use the Markdown object of the display machinery. A print-like function could thus look like

from IPython.display import Markdown, display
def printmd(string):
    display(Markdown(string))
printmd('**bold**')


来源:https://stackoverflow.com/questions/32026727/format-output-of-code-cell-with-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!