Markdown Jupyter Shortcut

Posted on  by admin

Shortcuts can be really useful to speed up writing your code. I will now walk you through some of the shortcuts I found most useful to use in Jupyter. There are two possible way to interact with Jupyter Notebook: Command Mode and Edit Mode. Some shortcuts work only on one mode or another while others are common to both modes. Markdown in Jupyter Notebook, Markdown cells can be selected in Jupyter Notebook by using the drop-down or also by the keyboard shortcut 'm/M' immediately after inserting Text can be added to Jupyter Notebooks using Markdown cells. You can change the cell type to Markdown by using the Cell menu, the toolbar, or the key shortcut m. JupyterLab Keyboard Shortcut Cheat Sheet. Jan 20, 2019 updated: Mar 3, 2020 A complete overview of the current JupyterLab keyboard shortcuts: (click on the picture to view it in full size or download the PDF below). One of the great things about Jupyter Notebook is how you can intersperse your code blocks with markdown blocks that you can use to add comments or simply more context around your code. Here are ten ways I like to use markdown in my Jupyter Notebooks. Use hashes for easy titles. In your markdown cell, enter a line like this. It took us far too long to start using custom shortcuts in Jupyter Lab. The default shortcuts in Jupyter Lab are good (take a look at our Jupyter Lab guide for a list of the most important default shortcuts), but there are a few parts of the data science workflow that the default shortcuts don’t cover.

  1. Jupyter Notebook Insert Cell Shortcut
  2. Markdown Jupiter Shortcut Key

One of the great things about Jupyter Notebook is how you can intersperse your code blocks with markdown blocks that you can use to add comments or simply more context around your code. Here are ten ways I like to use markdown in my Jupyter Notebooks.

1. Use hashes for easy titles

In your markdown cell, enter a line like this:

Keyboard shortcut markdown jupyter

That line will render as a header (h1 element).

2. Use asterisks and hyphens for bullet points

Try these lines in your markdown cell:

Both render as bullet point lists.

3. Use asterisks and underscores for emphasis

Next, try this:

The phrase I wanted to italicize italicized and the phrase I wanted to bold went bold, but both phrases rendered on the same line. What gives? I’ve noticed that some markdown behaves like this, but here’s a simple solution: add a <br> (HTML for line break) at the end of each line where you want a line break. So, write this in your markdown cell:

4. Center my headers with some HTML

Instead of using the hashtag shortcut, code your header elements directly and style them to center:

Interestingly, I’ve noticed that my centering works in Jupyter Notebook, but not in Jupyter Lab.

5. Create thick dividing lines with HTML

My notebooks that do a lot of exploratory data analysis before jumping into data modeling can get quite lengthy. I find that a nice, thick dividing line between sections can be a great visual indicator of the changing focus of my notebook. In a markdown cell, give this a try:

6. Write mathematical formulas

I’m more coder than math guy, but a formula or two can sometimes be helpful explaining your solution to a problem. Jupyter markdown cells support LaTeX, so give this a whirl:

7. Create hyperlinks

Jupyter Notebook Insert Cell Shortcut

Hyperlinks are easy in markdown:

Markdown Jupyter Shortcut

8. Drop in images with HTML

A picture is worth a thousand words:

9. Create nice tables

Use pipes and dashes to create a table in your markdown:

10. Escape text with three tick marks

Occasionally, I’ll want to show a code snippet in my markdown or other kind of escaped text. You can do that by surrounding your snippet with three back-tick characters:

Bonus: change the background color of your markdown cells

Shortcut

It never occurred to me until recently, but Notebooks bring with them a variety of style classes that you can leverage in your own markdown. Here are four examples (note: this is yet another markdown trick that works in Jupyter Notebook, but not in Jupyter Lab…at least the version I’m presently running):

Markdown Jupiter Shortcut Key

For all of this code, check out my notebook here. Also, here are twoother great posts on more markdown tips and tricks.