Markdown cheatsheet

Markdown cheatsheet

Markdown can help us write great README files describing our projects on GitHub which helps collaborators and other developers understand your projects with more clarity, so here's how we can quickly get up and running with markdown with this cheat sheet.

Here's how we can format text in a different way depending on our use case with Markdown:

  • Headings
  • Formatting texts
  • Horizontal rule
  • Paragraphs
  • Line break
  • Blockquotes
  • Links
  • Images
  • Lists
  • Code Blocks
  • Inline Code Block

Headings

There are six levels of heading with level one having one pound sign #, level two having two #, and so on.

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

Formatting texts

Bold

we can make the text bold by using __text__ or **text**

**This is bold text**
__This is also another way of making text bold__

Italics

we can make the text italics by using _text_ or *text*

*This is Italics text*
_This is also another way of making text Italics_

Bold and Italics

we can make the text Bold as well as in Italics by using ___text___ or ***text***

***This is Bold and Italics text***
___This is also Bold as well as Italics text___

Nesting Bold and Italics

we can nest the Bold text in Italics or the opposite by using * for bold and _ for Italics or vice versa.

**This is Bold text and _this is Italics text nested inside_**

Strikethrough

we can make a strikethrough text by using ~~text~~

~~This text is crossed off~~

Horizontal rule

We can create a horizontal rule by writing three or more asterisks(*), underscore(_), or dash(-) together in a line.

***

OR

*******

OR

---

OR

___

Paragraphs

To create paragraphs, we need to divide consecutive paragraphs with blank lines else they'll collapse into one block of text.

Paragraphs 

in markdown

Line break

We can create a line break by using a backslash at the end of the line and then we can continue in the next line.

This is on\
new line

Blockquotes

We can create blockquotes by adding > in front of the line

> This is a blockquote

Links

We can create links by writing link text in brackets [], () for link URL and for the text that needs to be displayed when hovering the link goes in "" after link URL ends in ()

[Google](https://www.google.com "Visit Google")

Images

To display images, we write the ! exclamation mark first, image alt text in [], and then image URL or image path in ()

![Image of a Bee](https://images.unsplash.com/photo-1497322313607-9fa0c2c4c4f8?ixlib=rb1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1937&q=80)

Lists

Ordered Lists

We can create ordered lists by writing number, a period after it and then the list content after that.

1. First
2. Second
3. Third

Unordered Lists

We can create unordered lists by writing a dash - and then the list content after that.

- First
- Second
- Third

Code Blocks

We can write blocks of code by wrapping them with three consecutive backticks ``` ```

const ratings = [5, 4, 5];
let sum = 0;

const sumFunction = async (a, b) => a + b;

ratings.forEach(async (rating) => {
  sum = await sumFunction(sum, rating);
});

console.log(sum);
// Naively expected output: 14
// Actual output: 0

```

Inline Code Block

We can write inline code blocks by wrapping them with a single backtick `. These are helpful when we want to mention any programming language's keywords like let, const etc..

`for`