Jupyter Notebook Markdown Cheat Sheet



Hello guys, happy to be back to another post!

Markdown cells can be selected in Jupyter Notebook by using the drop-down or also by the keyboard shortcut 'm/M' immediately after inserting a new cell. Headings The Headings starts with '#,' i.e., hash symbol followed by the space, and there are six Headings with the largest heading only using one hash symbol and the smallest titles using six. In this guide, we'll be using Jupyter notebooks to demonstrate markdown, however note that markdown is not Jupyter specific. Many other services and products use it to allow easy text formatting. NOTE: In our quick guide on how to use Jupyter notebooks, we mentioned that Jupyter allows changing the type of a cell to make it a markdown cell.

Today i will talk about something useful and not at all complex. It's more about helpful tips.

I was learning python and was using Jupyter Notebook, so i needed to learn the shortcuts to use it, so...

Here are some of the most used shortcuts for the jupyter notebook.

Shift-Enter: Run the cell selected and select below the cell you are currently in.

Ctrl-Enter: Run the cell selected, but don't jump to the next cell.

Alt-Enter: Run the cell selected and insert below.

Y: Code

M: Markdown.

R: Raw.

1 to 6: Headings.

A/B: Insert cell Above/Below.

X: Cut selected cell.

C: Copy selected cell.

Shift + V: Paste cell above.

V: Paste cell below.

Z: Undo last cell deletion.

Jupyter Notebook Markdown Cheat Sheet Excel

D,D: Delete selected cell.

O: Toggle output.

Shift+O: Toggle output scrolling.

Ctrl + ]: Indent.

Jupyter

How To Add Text In Jupyter

Ctrl + [: Dedent.

I think this are the most common and most used, hope it was useful!

The Python Markdown extension allows displaying output produced by the current kernelin markdown cells. The extensions is basically agnostic to the kernel language, however mosttesting has been done using Python.

For example:If you set variable a in Python

and write the following line in a markdown cell:

It will be displayed as:

The notebook needs to be trusted in order to execute Python commands in markdown.This is indicated by the “trusted” check mark:

If you see the “unstrusted” question mark, use File->Trust Notebook in the menu.

Caution: If you trust a notebook, you allow it to execute any code that is contained between the {{...}}curly braces on your notebook server.

Further examples¶

Before rendering the markdown cell:

After rendering the markdown cell:

Code is only executed when the notebook is trusted. So if your original code is shown asrendered markdown output, please make sure your notebook is trusted. You can check if the notebookis trusted by looking at the check mark at the top of the window.

Caution: There is no restriction in the expression you can embedd between the curly braces {{}}.Be careful as you might crash your browser if you return too large datasets, or worse.

Exporting¶

In order to have nbconvert show the computed output when exporting to another format,use the pre_pymarkdown.py preprocessor. If you used the pythonsetup.pyinstall command to install theIPython-contrib extension package, this will already be installed.

For manual setup, you need to copy this file to a location within the Python path (or extend PYTHONPATH).Additionally, you need to add these two lines to your jupyter_nbconvert_config.py configuration file:

Jupyter

Internals¶

The extension overrides the textcell.MarkdownCell.prototype.render function and searches for the expression enclosedin double curly braced {{<expr>}}. It then executes the expression and replaces it with the result returned fromthe running kernel, embedded in a <span> tag.Additionally, the result is saved in the metadata of the markdown cell, i.e. cell.metadata.variables[varname].This stored value is displayed when reloading the notebook and used for the nbconvert preprocesser.

The preprocessor pre_pymarkdown.PyMarkdownPreprocessor allows nbconvert to display the computed variableswhen converting the notebook to an output file format.

Unfortunately, embedding in LaTeX is not supported currently, as computing expressions between the curly bracesand rendering LaTeX equations is happening asynchronously, and it is difficult to handle this in a consistent way.Ideas or pull request to implement this functionality are welcome.