Table of contents
Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents.
In an application like Microsoft Word, you click buttons to format words and phrases, and the changes are visible immediately. Markdown isn’t like that. When you create a Markdown-formatted file, you add Markdown syntax to the text to indicate which words and phrases should look different.
This article is a quick overwiew of the Markdown synax elements.
Basic Syntax
These are the elements outlined in John Gruber’s original design document. All Markdown applications support these elements.
Headings:
# H1
## H2
### H3
#### H4
##### H5
###### H6
Output :
H1
H2
H3
H4
H5
H6
Alternatively, equals signs and hyphens can be used to mark headings. These are inserted in the line below the actual heading. This option only allows you to create two different sizes of headings.
Heading 1
=
Heading 2
-
Output :
Heading 1
Heading 2
Bold & italics
*Italic Text*
_Italic Text_
**Bold Text**
__Bold Text__
***Italic and Bold Text***
___Italic and Bold Text___
Output :
Italic Text
Italic Text
Bold Text
Bold Text
Italic and Bold Text
Italic and Bold Text
Strikethroughs
~~This text is struckthrough.~~ This one isn’t.
Paragraphs
The Markdown language works with hard line breaks to separate paragraphs from each other. To create a completely new block of text (
tag), simply add an empty line.
Quotes
>This is an **embedded section**.
>The section continues here
This line isn’t embedded any more.
Output :
This is an embedded section.
The section continues here
This line isn’t embedded any more.
Lists
Lists are of two types.
- Ordered List
- Unordered List
Ordered list
1. One
2. Two
3. Three (Press Enter+Tab for sub-list)
1. one
2. two
3. three
Unordered list
- One
- Two
- Three <!---Press Enter+Tab for sub-list-->
- one
- two
- three
Output:
Ordered list
- One
- Two
- Three
- one
- two
- three
Unordered list
- One
- Two
- Three
- one
- two
- three
Line Break
*** or ---
Code Block
```css
body {
background: #000;
}
```
Output :
body {
background: #000;
}
Links
[Link](https://www.google.com/)
Output:
Images
![Example](https://cdn.hashnode.com/res/hashnode/image/upload/v1658576557081/QIPF6voFI.jpeg?auto=compress,format&format=webp align="left")
Output :
Table
|SR.no|Content|
|-----|-------|
| 1 | One |
| 2 | Two |
| 3 | Three|
| 4 | Four |
Output :
SR.no | Content |
1 | One |
2 | Two |
3 | Three |
4 | Four |
Highlight
<mark>This is a highlighted text<mark>
Output:
This is a highlighted text
Super and Sub scripts
H<sub>2</sub>0
X<sup>2</sup>
Output :
H20
X2