What is Markdown?
- Mark down is a simple markup language which can be used for formatting documents.
- If you have written readme file for GitHub or asked a question on Stack overflow, you might be familiar with markdown.
- It can easily be converted to tons of different formats, mainly in HTML to display in browser. Even in writing this blog we have used markdown.
Some Basic Markdown syntax:
Heading:
To display a heading, add one to six #
(hash or pound) symbols before your heading text. The more the number of #
the less is the size of the heading.
Syntax
# This is a Heading 1
## This is a Heading 2
### This is a Heading 3
#### This is a Heading 4
##### This is a Heading 5
###### This is a Heading 6
Output
This is a Heading 1
This is a Heading 2
This is a Heading 3
This is a Heading 4
This is a Heading 5
This is a Heading 6
Bold Text
Use two *
(asterisk) or two _
(underscore) at the start and end to display bold text
Syntax
**This is a Bold Text 1**
__This is a Bold Text 2__
Output
This is a Bold Text 1
This is a Bold Text 2
Italicized Text
An Italic text can be displayed using one *
(asterisk) or one _
(underscore) symbol at the start and end of the text without any spaces.
Syntax
*This is an Italic Text 1*
_This is an Italic Text 2_
Output
This is an Italic Text 1
This is an Italic Text 2
To display both Italic and Bold Text use three *
(asterisk) or three _
(underscore) symbol at the start and end of the text without any spaces.
Syntax
***Bold and Italic Text 1***
___Bold and Italic Text 2___
Output
Bold and Italic Text 1
Bold and Italic Text 2
Strike
Strike through text can be achieved using two ~
at the start and end of the text.
Syntax
~~Strike Through Text~~
Output
Ordered List
Use numbers to display an Ordered list.
Syntax
1. Task One
1. Task two
1. Task three
Output
- Task One
- Task two
- Task three
Unordered List
Use -
(Hyphen) symbol to display an unordered list.
Syntax
- One
- Two
- Three
Output
- One
- Two
- Three
Nested List
For both Ordered and Unordered Nested List use indentation.
Syntax
Nested Ordered List
1. Task One
2. Task two
1. Sub Task One
2. Sub Task two
3. Task three
Nested Unordered List
- Task One
- Task Two
- Sub Task One
- Sub Task Two
- Task Three
Output
Nested Ordered List
- Task One
- Task two
- Sub Task One
- Sub Task two
- Task three
Nested Unordered List
- Task One
- Task Two
- Sub Task One
- Sub Task Two
- Task Three
Code Snippet
To display a piece of code in a single line use single ` sign at the start and end of the code text.
Syntax
In Javascript `var`, `let` and `const` are used to declare variables
Output
In Javascript var
, let
and const
are used to declare variables
But if you want to display a multiple lines of code use three ``` at start and end of the Code Snippet. You can also mention language of the code snippet.
Syntax
Output
for(int randomNumber = 0; randomNumber <= 10; randomNumber++) {
console.log(randomNumber);
}
Link
Combination of ()
and []
can be used to display a link in a markdown.
Syntax
[Click Here to go to Google](http://google.com)
Output
Image.
To display a image is same as displaying link just add !
at the start.
Syntax
![LCO](https://learncodeonline.in/mascot.png)
Output
Quote
To display a quote, use >
symbol followed by the text.
Syntax
> Honesty is the Best policy.
>> Change is as natural as Life.
Output
Honesty is the Best policy.
Change is as natural as Life.
Table
Use |
for rows and columns and -
for separating header and data.
Syntax
| Header1 | Header2 | Header3 |
|---------|---------|---------|
|data11 |data12 |data13 |
|data21 |data22 |data23 |
Output
Header1 | Header2 | Header3 |
data11 | data12 | data13 |
data21 | data22 | data23 |
If you found this blog helpful please share this with your friends and colleagues, so that they can write there readme file for there GitHub very quickly by just reading this blog for approx. 4 mins.