Skip to content

Instantly share code, notes, and snippets.

@data-enhanced
Created April 27, 2022 20:50
Show Gist options
  • Save data-enhanced/d65bc3eab1d08cb70fefd2860d147b25 to your computer and use it in GitHub Desktop.
Save data-enhanced/d65bc3eab1d08cb70fefd2860d147b25 to your computer and use it in GitHub Desktop.
# Format using Markdown ================================================
# Format Jupyter Code Output using Markdown
# https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html?highlight=display_markdown#IPython.display.display_markdown
from IPython.display import display_markdown
markdowntext = 'Markdown Heading Level 3'
display_markdown(f'### Code Output Formatted as {markdowntext}', raw=True)
display_markdown(f'_Code output italicized using_ `display_markdown`', raw=True)
# Format using HTML ================================================
# Format Jupyter Code Output using HTML
# https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html?highlight=display_#IPython.display.display_html
from IPython.display import display_html
htmltext = 'HTML h3'
display_html(f'<h3>{htmltext} Heading + <em>Emphasized</em></h3>', raw=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment