27

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?

scdmb
  • 15,091
  • 21
  • 85
  • 128
  • I Know this is an old question, but I suspect this is actually linked to the "Mode" the editor is in. When you see **bold** your are in "edit mode". This is denoted with a green left margin. If you switch to "Command Mode" (Control + ENTER) your you should get the text formatted in bold as you want – Steve Oct 07 '17 at 20:37

1 Answers1

50

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**')
Jakob
  • 19,815
  • 6
  • 75
  • 94
  • I would just add the `string=''` in case someone wants to replace the `print` function by `printmd` without any problem. Sometimes it is useful to use print() just to jump a line. In this case the function would return an error. – Sergio Polimante May 06 '22 at 20:30