# A quick cheat sheet of the Markdown syntax.

Have you thought at any point about how blog posts like [Hashnode](https://hashnode.com/) or [Medium](https://medium.com/)  are written? or how these 
readme. MD records are displayed on [Github](https://github.com/)? 

Whether you're new or you have been a developer, Forget about it! This is tutorial for any individual who want to learn Markdown. Since it's something everybody ought to be aware.


So Let me introduce you to markdown first,


## Introduction

Markdown is a lightweight markup language, used to write blogs, texts, books and you can  easily contribute it in many formats. It is created by John Gruber in 2004.

> It's file extension usually ends in ".md".

**Some advantages of markdown:**

- Easy and simple formatting.
- Can be converted to many different formats easily.
- Pleasant syntax and easy to learn.
- Platform independent.

## Basic syntax

### Headings
> To create a heading, add number signs (#) in front of a word or phrase. The number of number signs you use should correspond to the heading level. 

| Markdown Syntax      | HTML Syntax              | Output                          |
| ----------------------| ---------------------- | ----------------------  |
| `# Heading level 1`         | `<h1>Heading level 1</h1>`         |    <h1>Heading level 1</h1> |
| `## Heading level 2`         | `<h2>Heading level 2</h2>`   | <h2>Heading level 2</h2> |
| `### Heading level 3`         | `<h3>Heading level 3</h3>`         |    <h3>Heading level 3</h3> |
| `#### Heading level 4`         | `<h4>Heading level 4</h4>`   | <h4>Heading level 4</h4> |
| `##### Heading level 5`         | `<h5>Heading level 5</h5>`         |    <h5>Heading level 5</h5> |
| `###### Heading level 6`         | `<h6>Heading level 6</h6>`   | <h6>Heading level 6</h6> |

### Paragraphs
> To create paragraphs, use a blank line to separate one or more lines of text.

| Markdown Syntax      | HTML Syntax              | Output                          |
| ----------------------| ---------------------- | ----------------------  |
| I really like using Markdown.         | `<p>I really like using Markdown.</p>`         |    I really like using Markdown. |
| This is the first line.   <br> And this is the second line.| `<p>This is the first line.<br>And this is the second line.</p>`   | This is the first line.<br>And this is the second line.|

### Emphasis
> You can add emphasis by making text bold or italic.

#### Bold
To bold text, add two asterisks or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters.

| Markdown Syntax            |HTML Syntax              | Output                          |
| --------------------------| ---------------------- | ----------------------  |
| `I just love **bold text**.`                  | `I just love <strong>bold text</strong>.`|I just love <strong>bold text</strong>.|
| `I just love __bold text__.`                   | `I just love <strong>bold text</strong>.`|I just love <strong>bold text</strong>.|

#### Italic
To italicize text, add one asterisk or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters.

| Markdown Syntax            |HTML Syntax              | Output                          |
| --------------------------| ---------------------- | ----------------------  |
| `I am a *italic text*.`                  | `I am a <em>italic text</em>.`|I am a <em>italic text</em>.|
| `I am a _italic text_`                  | `I am a <em>italic text</em>.`|I am a <em>italic text</em>.|

#### Bold and Italic
To emphasize text with bold and italics at the same time, add three asterisks or underscores before and after a word or phrase. To bold and italicize the middle of a word for emphasis, add three asterisks without spaces around the letters.

| Markdown Syntax            |HTML Syntax              | Output                          |
| --------------------------| ---------------------- | ----------------------  |
| `I am a ***strong italic text***.`                  | `I am a <em><strong>strong italic text</strong></em>.`|I am a <em><strong>strong italic text</strong></em>.|
| `I am a ___italic text___`                  | `I am a <em><strong>strong italic text</strong></em>.`|I am a <em><strong>strong italic text</strong></em>.|

#### Strike text
for strike through text add double tilde (~) before and after a word or phrase. 

| Markdown Syntax            |HTML Syntax              | Output                          |
| --------------------------| ---------------------- | ----------------------  |
| `I am a ~~strike through text~~.`                  | `I am a <del>strike through text</del>.`|I am a <del>strike through text</del>.|


#### Blockquotes

To create a blockquote, add a > in front of a paragraph.

`> Dorothy followed her through many of the beautiful rooms in her castle.`

The rendered output looks like this:

> Dorothy followed her through many of the beautiful rooms in her castle.

#### Blockquotes with Multiple Paragraphs
Blockquotes can contain multiple paragraphs. Add a > on the blank lines between the paragraphs.

```markdown
> Dorothy followed her through many of the beautiful rooms in her castle.
>
> The Witch bade her clean the pots and kettles.
```
The rendered output looks like this:

> Dorothy followed her through many of the beautiful rooms in her castle.
>
> The Witch bade her clean the pots and kettles.

#### Nested Blockquotes
Blockquotes can be nested. Add a >> in front of the paragraph you want to nest.

```markdown
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles.
```
The rendered output looks like this:

> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles.


### Horizonal Line
> You can organize items into ordered and unordered lists.


### Lists
> To create a horizonal  line , Use triple dash(-).

#### Ordered Lists
To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.

**Markdown Syntax** 

```markdown
1. First item
2. Second item
3. Third item
4. Fourth item
```          
**HTMLSyntax** 

```html
<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
  <li>Fourth item</li>
</ol>
```

**Output** 

1. First item
2. Second item
3. Third item
4. Fourth item
---
**Markdown Syntax** 

```markdown
1. First item
2. Second item
  1. First sub item
  2. Second sub item
3. Third item
4. Fourth item
```          
**HTMLSyntax** 

```html
 <ol>
      <li>First item</li>
      <li>
        Second item
        <ol>
          <li>First sub item</li>
          <li>Second sub item</li>
        </ol>
      </li>
      <li>Third item</li>
      <li>Fourth item</li>
    </ol>
```

**Output** 

1. First item
2. Second item
  1. First sub item
  2. Second sub item
3. Third item
4. Fourth item


#### Unordered Lists
To create an unordered list, add dashes (-), asterisks (*), or plus signs (+) in front of line items. Indent one or more items to create a nested list.

**Markdown Syntax** 

```markdown
- First item
- Second item
- Third item
- Fourth item
```          
**HTMLSyntax** 

```html
<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
  <li>Fourth item</li>
</ul>
```

**Output** 

- First item
- Second item
- Third item
- Fourth item

---
**Markdown Syntax** 

```markdown
- First item
- Second item
  - First sub item
  - Second sub item
- Third item
- Fourth item
```          
**HTMLSyntax** 

```html
 <ul>
      <li>First item</li>
      <li>
        Second item
        <ul>
          <li>First sub item</li>
          <li>Second sub item</li>
        </ol>
      </li>
      <li>Third item</li>
      <li>Fourth item</li>
    </ul>
```

**Output** 

- First item
- Second item
  - First sub item
  - Second sub item
- Third item
- Fourth item

### Code Blocks
> Code blocks are normally indented four spaces or one tab. When they’re in a list, indent them eight spaces or two tabs .
> You can use triple tilde and followed by enter for muliple lines of code.

**Markdown Syntax** 

To format below lines of code , use this (```) around the code.
<p>
&#96;&#96;&#96;
<br>
`<html>`
<br>&nbsp;&nbsp;
`    <head>`
<br>&nbsp;&nbsp;&nbsp;&nbsp;
`       <title>Test</title>`
<br>&nbsp;&nbsp;
`     </head>`
<br>
`</html>` 
<br>
&#96;&#96;&#96;
</p>

**Output** 


```
<html>
    <head>
       <title>Test</title>
     </head>
</html>
```

### Links
> To create a link, enclose the link text in brackets (e.g., [Duck Duck Go]) and then follow it immediately with the URL in parentheses (e.g., (https://duckduckgo.com)).

**Markdown Syntax** 

`My favorite search engine is [Duck Duck Go](https://duckduckgo.com).`

**Output** 

My favorite search engine is [Duck Duck Go](https://duckduckgo.com).

---
> You can optionally add a title for a link. This will appear as a tooltip when the user hovers over the link. To add a title, enclose it in quotation marks after the URL.

**Markdown Syntax** 

`My favorite search engine is [Duck Duck Go](https://duckduckgo.com "Go Go").`

**Output** 

My favorite search engine is [Duck Duck Go](https://duckduckgo.com).

### Images
> To add an image, add an exclamation mark (!), followed by alt text in brackets, and the path or URL to the image asset in parentheses. You can optionally add a title in quotation marks after the path or URL.


>> You can also give a realtive path like this `./images/logo.png`


**Markdown Syntax** 

`![girl-with-long-brown-hair-standing-in-grassland!](https://images.pexels.com/photos/12576758/pexels-photo-12576758.jpeg)`

**Output** 

![girl-with-long-brown-hair-standing-in-grassland!](https://images.pexels.com/photos/12576758/pexels-photo-12576758.jpeg)


### Tables
> To add a table, use three or more hyphens (---) to create each column’s header, and use pipes (|) to separate each column. For compatibility, you should also add a pipe on either end of the row.

 
**Markdown Syntax** 

```markdown
| Syntax      | Description |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |
```

**Output** 

| Syntax      | Description |
| ----------- | ----------- |
| Header      | Title       |
| Paragraph   | Text        |


### References

[Markdown Basic syntax](https://www.markdownguide.org/basic-syntax/)

[Markdown Extended syntax](https://www.markdownguide.org/extended-syntax/)

[Markdown Cheat sheet ](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)

### Finished
That's it for today!

Hope you liked the post, if you’ve got any questions your can Mail me madhabapatra@gmail.com.

Thanks
