Markdown Cheat Sheet.

Markdown Cheat Sheet.

Markdown Cheat Sheet For Smart Coders.

What is Markdown?

Before going through the cheat sheet, let's understand what is markdown? So markdown is a lightweight markup language, it is used for formatting text, it gives you a way to write your text so that it can be compiled into HTML. Markdown has been since around 2004 introduced by "John Gruber" and "Aaron Swartz". Markdown is widely used in writing blog posts, online forums, collaborative software, documentation pages, note-taking apps, and readme files(GitHub, etc). Markdown files end with .md For example: readme.md

Things you can format with markdown.

  • Heading
  • Lists
  • Emphasis
  • Links
  • Blocks of code
  • Images
  • Strikethrough
  • Horizontal Rules
  • Tables
  • BlockQuote

Markdown Cheat Sheet.

1. Headings

There you can write six types of heading just like in HTML. So to write headings in markdown you have to use hash (#)

For example:

# Heading 1 
## Heading 2 
### Heading 3
#### Heading 4 
##### Heading 5 
###### Heading 6

Output:

Headings 1 to 6

2. Lists

Just like HTML, there are also two types of lists that you can use, ordered and unordered lists.

  • Unordered lists

Here you can write the unordered list in two ways:

  • using a hyphen(-) at the beginning
  • using an asterisk(*) at the beginning

For example:

**Unordered Lists**

- item 1( with -)
    - sub-item 1( with -)
    * sub-item 2( with *)
    * sub-item 3( with *)
- item 2( with -)
* item 3( with *)

Output:

Unordered list

  • Ordered lists

Here you can also write the ordered list in two ways:

  • normal number sequence
  • just write 1 at the beginning of every line

For example:

**Ordered Lists**

1. item 1
    1. sub-item with 1
    1. sub-item with 1
    1. sub-item with 1
2.  item 2
3. item 3

Output:

Ordered list

3. Bold

You can write bolded texts, using the double-asterisk(**) or double-underscore(__) at the beginning as well as at the end of the text.

For example:

 **Bold**

**This text is Bolded using a double asterisk** 

__This is bolded using double underscore__

Output:

Bold

4. Italic

You can write Italic texts also, using the single-asterisk(*) or single-underscore(_) at the beginning as well as at the end of the text.

For example:

 *Italic*

*This text is Bolded using the double asterisk* 

_This is bolded using double underscore_

Output:

Italic

Providing Links in your markdown files. You see in the example there are two brackets, first square bracket tells what is the link about, and the second parentheses is for the path of the link

For example:

 **Links**

[This is Google link, on hover no title will be shown](https://www.google.com)

[This is Google link, on hover title will be shown](https://www.google.com "Google")

Output:

Links

6. Images

For images in markdown files, the syntax is the same as the links only difference is the exclamation sign at the beginning of the square bracket. You can also link an image using link syntax, in a square bracket put the whole image syntax, and inside the parentheses of the link give the path as shown in the example.

For example:

**Image**

![Image](./BM%20logo.jpeg)
without link

[![Image](./BM%20logo.jpeg)](https://wwww.google.com) 

with link

Output:

Images

7. Blocks of code

You can also write code in markdown files. If you want to use any keyword or code in between the text line you have to use single backticks(`) before and after the keyword or code and for multi-line code, you have to use triple backticks(```) before and after the code line.

For example:

Bolck of code markdown

Output:

Block of code

8. Strikethrough

Strike-Through is used to cut the old data to update with new data. Mostly used on e-commerce sites to give offers. The syntax is a double tilde sign at the start and end of the text.

For example:

**Strikethrough**

~~This text is Strikethrough~~ 

~~578~~ **499**

~~double tilde in beginning as well as at the end

Output:

Strikethrough

9. Horizontal Rules

Horizontal Rules are used to create horizontal lines. The syntax is a triple hyphen(---) or triple underscore(___) sign.

For example:

**Horizontal Rule** 

---
___

Output:

Horizontal line

10. BlockQuote

The blockquote is used to write quotes but it's not necessary. the syntax for the blockquote is put greater than the sign at the starting of the text.

For example:

**BlockQuotes** 
> This is a quote1 This is a quote2 This is a 
quote3 This is a quote4 This is a quote5 This is a quote6 This is a quote7 This is a quote8 This is a quote9. 
>
> --***Unknown***

> this blockquote

Output:

Blockquotes

11. Tables

Tables are always useful to have first of all the data looks pretty and is easy to access the data. to create a table look in the markdown file use a pipe sign after every data, first create a header row then below the header row create a horizontal line using hyphens at least three, and to align the text center use colon at the start of the hyphen as well as at the end, to align left put colon only at the left and for align right put the colon at the right as shown in the example.

For example:

**Tables**

| Name      | Email     |
|:----------|:--------- |
| Suresh    | suresh@gmail.com  |
| Ram       | ram@gmail.com     |
| Rajesh    | rajesh@gmail.com  |

Output:

Tables

I hope this article helps you in learning the markdown. Thank you!