Markdown in Jupyter Notebook
In this tutorial, you'll learn how to use and write with different markup tags using Jupyter Notebook.
Markdown is a lightweight and popular Markup language which is a writing standard for data scientists and analysts. It is often converted into the corresponding HTML by the Markdown processor which allows it to be easily shared between different devices and people.
Markup language is similar to Hypertext Markup Language(HTML) made of Markup tags, and it consists of the opening tag <tagname> and closing tag </tagname>.
In this tutorial, you can see the same result obtained by using Markup tags, and also the Markdown syntax which is supported by Jupyter Notebook.
- Headings
- Blockquotes
- Code section
- Mathematical Symbol
- Line Break
- Bold and Italic Text
- Horizontal Lines
- Ordered List
- Unordered List
- Internal and External Link
- Table
- Image
You need to have Jupyter Notebook, the environment can be set up by using DataCamp's tutorial: Jupyter Notebook Tutorial: The Definitive Guide.
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 hash symbols.
# (Header 1, title)
## (Header 2, major headings)
### (Header 3, subheadings)
#### (Header 4)
##### (Header 5)
###### (Header 6)
Alternatively, the headings can start with Markup Tags, i.e., from h1 to h6 with the following syntaxes.
<h1>Header 1, title<h1>
<h2>Header 2, major headings<h2>
<h3>Header 3, subheadings<h3>
<h4>Header 4<h4>
<h5>Header 5<h5>
<h6>Header 6<h6>
Both of the syntaxes above can render the headings from h1 to h6 after clicking the 'Run' in the toolbar.
Try it yourself in the markdown cell below
heading_1
heading_2
heading_3
heading_4
heading_5
heading_6
Blockquotes
Blockquotes can hold a large chunk of text and are generally indented. They can be obtained by using Markdown symbol '>' or with <blockquote>text for blockquote</blockquote>
-
> This is good
-
<blockquote> This is good </blockquote>
Both of the syntaxes above can render the text in indented form after clicking 'Run' in the toolbar.
Try it yourself in the markdown cell below
this is a block quote
This is an indented block quote.
this is the most inner onewhat about this?I don't know!
Code section
The Code section is the part that specifies the code of different programming languages and can be rendered where inline code starts with ' `inline code goes here` ' back-ticks around it, but the block of code starts with three back-ticks ' ``` block line code goes here ``` '. Also,the Markup tag for a Code section is ' <code>code goes here<code> '.
The inline code example is given below:
`x =5`
You can see after clicking "Run" the inline code renders with highlighting the code.
Code section examples are given below:
Using Markdown
```
Python
str = "This is block level code"
print(str)
```
Using Markup Tag
<code>
Python
str = "This is a block level code"
print(str)
</code>
Using Markdown, you can get the syntax highlighting of code if programming language name is mentioned after the '```' three ticks and the example is given below:
Using Markdown, you will not get syntax highlighting, but code is highlighted:
Try it yourself in the markdown cell below
name = 'pirikli' print(name) print(type(name))
git init git remote add https://github.com/pirikli/LearNotes.git
Mathematical Symbol
The mathematical symbol in Markdown is included in
$\sqrt{k} $
The above example will render the mathematical expression in a bold format.
Try it yourself in the markdown cell below
Line Break
The line break tag starts with <br> tag with no closing tag which breaks the line, and the remaining contents begin with a new line with the example shown below.
The line breaks after using <br> br tags and it is awesome.
After clicking the 'Run' in the toolbar, you can see the line break after using the <br> tag. The remaining text starts in a new line.