Markdown Cheat Sheet Jupyter



Jupyter Notebook is a great tool for data analysis. And one of its greatest features is that you can easily combine runnable code with rich-text annotations. Markdown cells that contain such annotations support both HTML and Markdown syntax.

Personally I prefer # Header (markdown syntax) to <h1>Header</h1> (HTML syntax) in my notebook’s cells as the former looks more human. So I use markdown syntax more often and a concise cheat sheet for Jupyter Notebook markdown is what I was missing for a long time. Yes, I’m aware of such comprehensive cheat sheets like this and this, they are great but too verbal and it’s hard to print them on one page to have it easily accessible.

Eventually, I decided to gather all crucial points of the markdown syntax that are actual for Jupyter notebook and combine them in a concise cheat sheet that I present to you. It doesn’t explain much but should be useful if you simply forgot something. Click the picture to download the PDF version.

Here’s how to format Markdown cells in Jupyter notebooks: HeadingsUse the number sign (#) followed by a blank space for notebook titles and section headings: # for titles ## for major headings ### for subheadings #### for 4th level subheadings; EmphasisUse the following code to emphasize text: Bold text: string or.string. Description: Jupyter notebook Homework 1/HW 1.2 - Markdown and LaTeX Cheatsheet.ipynb Compute Environment: Ubuntu 18.04 (Deprecated) Unless otherwise specified, each part of this problem is worth 0.1 points, for a total of 2.75 points. Sometimes markdown doesn’t make line breaks when you want them. To force a linebreak, use the following code: Indenting Use the greater than sign followed by a space, for example: Text that will be indented when the Markdown is rendered. Any subsequent text.

Markdown Cheat Sheet Jupyter Grade

I didn’t get into the details of LaTeX syntax (see the penultimate cell in the cheat sheet with the square root of k) since it’s well described here (get ready, it’s a very long document) and you can even download a pretty good cheat sheet here.

Contents

Git

Command

Description

git init

Initialize git in the working directory

git add .

Add all modified files to the staging area

git clone <GIT_REPO> <DIR>

Clone the master branch from a GitHub repository

git clone -b <BRANCH_NAME> <GIT_REPO> <DIR>

Clone a specified branch from a GitHub repository

git checkout .

Discard all changes in your working copy

git status

Check files that are changed, and need to be committed

git remote set-url origin <URL_NAME>

Add a remote directory to origin so you can push your local repository to it

git remote -v

List all remote repositories

git push origin master

Push your local repository to the origin url into the master branch

git diff

Show changes between your working copy and the tree

git pull

Fetch and merge changes from remote repository to your working repository

git submodule add <GIT_REPO> <DIR>

Add submodule GitHub repositories to one of the subfolders of your working repository

git submodule recursive

Recursively update all submodules in your working repository

git config --global credential.helper cache

Git to start caching credentials

git config --global credential.helper 'cache --timeout=7200'

Git to cache credentials for 2 hours

Jupiter Keyboard Shortcut Cheat Sheet

Jupyter Labextension

Command

Description

jupyter labextension list

List all labextensions

jupyter labextension upgrade

Update all labextensions

jupyter labextension install <EXTENSION_NAME>

Install an extension and build

jupyter labextension uninstall <EXTENSION_NAME>

Uninstall an extension and build

jupyter labextension install <EXTENSION_NAME> --no-build

Install an extension but do not build

jupyter lab build

Build jupyter

Conda

Command

Description

source activate <ENV_NAME>

Activate an environment (Linux)

conda activate <ENV_NAME>

Activate an environment (Windows)

conda list

Show all packages in current environment

conda install <PKG1> <PKG2> <PKG3>

Install latest versions of Python packages <PKG1> <PKG2> <PKG3>

conda install <PKG1>=<VER>

Install version <VER> of Python package <PKG1>

conda list --explicit > 'my_env_packages.txt'

Write all packages in current environment into the txt file

conda create --name <ENV_NAME> --file 'my_eng_packages.txt'

Create a new environment and install all files in the txt file

conda env export > 'my_eng_packages.yml'

Export current environment and package informaion into a yml file

conda create -f 'my_env_packages.yml'

Create a new environment based on a yml file

conda config --get

Get summary of conda channel configuration

conda config --prepend channels <CHANNEL_NAME>

Add channel with highest priority

conda config --append channels <CHANNEL_NAME>

Add channel with lowest priority

conda config --set channel_priority false

Install the newest version of a package in any listed channel

conda remove -n <ENV_NAME> --all

Remove environment

Jupyter

Nikola

Jupyter Lab Cheat Sheet

Command

Description

nikola build

Build nikola website

nikola serve -b

Display localhost:8000 version of website

nikola auto

Automatically scan changes to your edits of the website to build and serve on localhost:8000

nikola github_deploy

Publish website on GitHub Pages. Commits and pushed both the src and master branches of the GitHub Page.

nikola plugin -i <PLUGIN_NAME>

Install nikola plugins

nikola plugin -r <PLUGIN_NAME>

Uninstall nikola plugins

nikola subtheme <THEME_NAME>

Select a subtheme from bootswatch (i.e., lumen)

Markdown

Command

Description

[File Title](file.md)

Links to file.md in current directory

[File Title](subfolder/file.md)

Links to file.md in subfolder of current directory

[File Title](../folder/file.md)

Links to file.md from your repository folder (i.e., blog2)

![File Title](pic.jpg)

Shows picture of pic.jpg stored in current directory

<!-- TEASER_END -->

Teaser end for non .md and .html files

Kaggle API

Command

Description

kaggle competitions list

List all competitions

kaggle competitions list --category <CATEGORY>

List featured competitions

kaggle competitions download <COMPETITION>

Download all files associated to competition

Markdown Cheat Sheet Jupyter English

reStructuredText

Markdown Cheat Sheet Jupyter

Sheet

Command

Description

.. title:

Title of page

.. slug:

Slug of the page used as the last component of the page URL

.. date:

Date of the page

.. category:

Category of the page (only one)

.. tags:

Comma-separated list of page tags (multiple tags)

.. description:

Description of page used for SEO

.. author:

Author of page

.. has_math:

Activate MathJax/KaTeX (true/false)

.. status:

Used to indicate status of the page (published/private/draft/featured)

.. hidetitle:

Show/hide title (true/false)

.. hyphenate:

Activate hyphenation (true/false)

.. TEASER_END

Teaser end used for blog post previews

.. previewimage

Image preview that is used when sharing on social feeds

.. template

Template to render the package

.. updated

Date that post was updated

.. class:: alert alert-primaryfloat-md-right

ReST directive to create a floating alert box to the right

.. contents::

ReST directive to create contents page

.. code:: python

ReST directive for a code-block in Python (shell for Linux, html for html, rst for reStructured, md for Markdown). Code-block must be indented.

:number-lines:

Include line numbers for code-blocks. Command must be indented

Directives

tmux

Command

Description

Ctrl + b w

List windows

Ctrl + b c

Create window

Ctrl + b &

Delete window

Ctrl + b p

Previous window

Ctrl + b n

Next window

Ctrl + b %

Split pane vertically

Ctrl + b '

Split pane horizontally

Ctrl + b <ARROW KEY>

Move to the pane in the direction of the <ARROW KEY>

Ctrl + b + <ARROW KEY>

Resize of pane according to the <ARROW KEY>