Introduction
Markdown is a markup language just like HTML. We use it to convert plain text into beautifully formatted text. If you are a developer you need to know markdown. Here, you will learn about the major markdown commands that will help you create an awesome Github README.
Headings
This is the syntax
# Heading 1 ## Heading 2 ### Heading 3 #### Heading 4 ##### Heading 5 ###### Heading 6
Output:
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
*Always remember to add space after
#
otherwise it will not work.
Paragraphs
For paragraphs, there is no need to give any commands, spaces, or tabs. Just write plain text and the formatting application will acknowledge it as a paragraph.
Line Break
For line break, use the <br>
tag
This is the syntax
This is the first line.<br> This is the second line.
Output:
This is the first line.
This is the second line.
Bold
You can use two asterisks **
or two underscores __
to make the text bold. But don't use underscores in the middle of a word, it may create trouble.
- This is the syntax
**This is bold text 1.**
__This is bold text 2.__
Output:
This is bold text 1. This is bold text 2.
Italic
You can use one asterisks *
or one underscores _
to make the text italic. But don't use underscores in the middle of a word, it may create trouble.
- This is the syntax
*This is italic text 1.*
_This is italic text 2._
Output:
This is italic text 1. This is italic text 2.
Blockquotes
You can use greater than sign >
to create a blockquote and double greater than sign >>
to create a nested blockquote. Other text styles can also be added inside a blockquote, such as bold or italic text styles.
- This is the syntax
Blockquote
> This is a blockquote text.
>> This is a nested blockquote text.
Output:
This is a blockquote text.
This is a nested blockquote text.
Strike-through
For a strike-through style, we can use two tilda signs ~~
.
- This is the syntax
~~This is a strike-through text~~
Output:
This is a strike-through text
Code
To denote a word or phrase as code, enclose it in backticks (`).
- This is the syntax
This is a `code block`
Output:
This is a
code block
To highlight code syntax within the text, enclose it in triple backticks (```).
- This is the syntax
```
function myFunction() {
console.log("Hello World!");
}
```
Output:
function myFunction() { console.log("Hello World!"); }
To highlight the text even more we can add the language name like this
- This is the syntax
```javascript
function myFunction() {
console.log("Hello World!");
}
```
Output:
function myFunction() { console.log("Hello World!"); }
Ordered List
For the ordered list, put numbers and then space.
- This is the syntax
1. One
1. Two
1. Three
Output:
- One
- Two
- Three
Unordered List
For the unordered list, put -
or *
and then space.
- This is the syntax
- One
* Two
Output:
- One
- Two
Link
The syntax for putting up a link is [Text](Link)
.
- This is the syntax
[Google](https://www.google.com/)
Output:
Image
The syntax for putting up an image is ![alt text](image.jpg)
.
- This is the syntax
![Markdown image](markdown.png)
- Output:
Table
To create a table with headers we need to use dashes to separate each header cell and use pipes to separate columns. The outer pipes are optional. Any number of dashes and spaces to increase readability. We can use colons :
to align columns. For left-align text, use a :
to the left of dashes. For center-align text, use a :
on both sides of the dashes. For right-align text, use a :
to the right of dashes. By default Left align is used.
- This is the syntax
| Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |
- Output:
Syntax | Description |
Header | Title |
Paragraph | Text |
Horizontal Rule
To create a horizontal rule, use three or more asterisks (*), dashes (---), or underscores (___) on a line by themselves.
- This is the syntax
---
***
___
- Output:
That's it. For more resources refer:-