You can put comments in your Jupyter Notebook code to help the reader to understand what you are up to. But longer commentary is better in text cells separate from the code.

Text cells in Jupyter support the Markdown language and we are going to take a look at the facilities that it offers. Markdown is a set of simple markup codes that are easily transformed into HTML for rendering in a browser. Markdown is nowhere near as sophisticated, or complex, as HTML but is perfectly adequate for documenting a notebook (although can also embed HTML if you need more control over the look or layout).

This article was initially written in Markdown (there is a link to the original at the end of this article) and the first paragraph and the two headings looks like this:

## Jupyter and Markdown
### Making your Notebooks look good
Whether you are sharing your Jupyter Notebooks with friends and colleagues or publishing them more widely, they will be better appreciated if they are well layed out and formatted.

Very simple. The ## precedes a heading equivalent to

in HTML, two of them means a secondary heading,

. The more ## symbols, the smaller the heading.

So the following Markdown code will display a list of headings gradually reducing in size.

## heading 1
### heading 2
#### heading 3
##### heading 4
###### heading 5
####### heading 6

Image for post

Image by Author

Markdown supports the most common styling such as bold and italic, you can construct lists both numbered and unnumbered. You can embed code within a paragraph or display a complete code block. Hyperlinks are included and you can insert images, too. Tables can be constructed with left and right justified columns with very simple syntax.

Markdown ignores single line breaks, so to separate paragraphs, you need to insert two line breaks.

Below we are going to go through some examples of the Markdown code. For each example I’ll show you the Markdown code and then follow it with the way that it will look after being rendered.

#programming #data-science #jupyter-notebook #markdown

Jupyter and Markdown
1.35 GEEK