All I've found useful concerning Markdown
with my favorite tips and shortcuts ✨

About Markdown

β€’ What is Markdown

"Markdown is a lightweight markup language with plain text formatting syntax. Its design allows it to be converted to many output formats, but the original tool by the same name only supports HTML. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.(...)
John Gruber created the Markdown language in 2004 in collaboration with Aaron Swartz on the syntax, with the goal of enabling people "to write using an easy-to-read and easy-to-write plain text format (...)"."
Markdown on Wikipedia

β€’ Use Markdown

Markdown is useful in GitHub and other version control softwares, as well as in Slack, Discord...

It helps you display your content with more accuracy and style it your own way

It's especially handy to create professional and polished README files πŸ™Œfor your GitHub repositories

Text and Line breaks

β€’ Typing text and creating line breaks and paragraphs in Markdown

- If you type this:

"This is the first paragraph
and I want this to be on the line just below."

You'll get something that will look like this below in Markdown:

"This is the first paragraph and I want this to be on the line just below."

Probably not what you expected πŸ€”

- Also, if you type this:

"This is the first paragraph

and I want this to be on the line just below."

You'll get something that will look like this below in Mardown:

"This is the first paragraph

and I want this to be on the line just below."

Probably not what you expected either ☹️

- To get a simple line break like this:

"This is the first paragraph
and I want this to be on the line just below."

You have two options:

  • Add two spaces at the end of the first line
  • Add a <br> tag at the end of the first line

- To create a new paragraph, you must leave an empty line (2nd example above)

Headings and Titles

β€’ Just like in HTML, there are 6 levels of titles in Markdown

Typing this:

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

Will look like this below in Markdown:

Heading 1


Heading 2


Heading 3

Heading 4

Heading 5
Heading 6

Tip: there is a shortcut for Headings 1 and 2

- For Heading 1, typing this:

Heading
===

Will produce a Heading 1 like this below in Markdown:

Heading 1


- For Heading 2, typing this:

Heading
---

Will produce a Heading 2 like this below in Markdown:

Heading 2


Horizontal Rules

β€’ To create an horizontal divider in your page, Markdown has an option equivalent to the HTML <hr> tag, only a bit thicker

Typing three or more hyphens:

---

Or typing three or more asterisks:

***

Or typing three or more underscores:

___

Will produce a line like this below in Markdown:


Styling and Emphasis

β€’ There are three main ways to add style to text in Markdown

- To add italic effect, you can type one underscore before and after your text:

_This creates italic effect_

Or type one asterisk before and after your text:

*this also creates italic effect*

- To add bold effect, you can type two underscore before and after your text:

__This creates bold effect__

Or type two asterisks before and after your text:

**this also creates bold effect**

Tip: to help recognize different style easier and faster, it is stongly suggested to use different notation for italic and bold

  1. One underscore for italic and double asterisks for bold
  2. One asterisk for italic and double underscores for bold

To combine them, typing this:

Combined style with both italic and bold: _**combined**_, or *__combined__* as well

Will look like this below in Markdown:

Combined style with both italic and bold: combined, or combined as well πŸ‘πŸ‘πŸ‘

- To add strikethrough effect, you can type two tilde before and after your text:

~~This creates strikethrough effect~~

- Some more styling in the HTML in Markdown Section

Quotes

β€’ Markdown allows you to showcase some text as a "blockquote"
These are all about adding a grey left border to the text and dealing with line breaks

Typing this:

> This is a quote

Will look like this below in Markdown:

This is a quote

- In case you want your quote on two or more lines (not paragraphs), remember the first section about how to break lines without creating a new paragraph, and either add two spaces or add a <br> tag at the end of the first line.

Typing this:

> This is the first line of the quote<br>
> and this is the second line of the quote

Will look like this below in Markdown:

This is the first line of the quote
and this is the second line of the quote

- In the case your quote is longer than one line, typing this:

> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Will look like this below in Markdown:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

- In case you want to add the name of the author on the last line, typing this:

> This is the quote<br>
> - from Author

Will look like this below in Markdown:

This is the quote
β€’ from Author

Note: you can also style your quote text with italic, bold or strikethrough, and you can add links or images inside.

Typing this:

> **Markdown** is a _lightweight markup language_ with plain text formatting syntax designed so that it can be converted to **HTML** and many other formats.
> - from [Wikipedia](https://en.wikipedia.org/wiki/Markdown)

Will look like this below in Markdown:

Markdown is a lightweight markup language with plain text formatting syntax designed so that it can be converted to HTML and many other formats.
β€’ from Wikipedia
Lists

β€’ In Markdown, you can create ordered or unordered lists, as well as nested ordered or unordered lists

- You can create unordered list by using a "-" or a "*" in front of each item

Typing this:

- item
- item
- item

Or typing this:

* item
* item
* item

Will look like this below in Markdown:

  • item
  • item
  • item

- You can create ordered list by using numbers

Tip: no need to number your items yourself, Markdown will do it for you πŸ˜‰

Typing this:

1. item 1
2. item 2
3. item 3

Or typing this:

0. item 1
0. item 2
0. item 3

Will look like below this below in Markdown:

  1. item 1
  2. item 2
  3. item 3

- You can also create nested ordered or unordered lists (up to three levels)

For unordered lists, typing this:

- Category 1
- item 1
- item 2
- Category 2
- item 1
- item 2

Or typing this:

* Category 1
* item 1
* item 1
* Category 2
* item 1
* item 1

Or typing this:

+ Category 1
+ item 1
+ item 1
+ Category 2
+ item 1
+ item 1

Or mixing "-" and "*" and "+"

Will look like this below in Markdown:

  • Category 1
    • item 1
    • item 2
  • Category 2
    • item 1
    • item 2

Note: nested ordered lists work the same 😎

More details here

Code Blocks

β€’ You can add two categories of code blocks to your Markdown πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

- Inline code blocks use back-ticks

Typing:

This is some inline `code`

Will look like this below in Markdown:

This is some inline code

- Blocks of code are either indented with four spaces, or fenced by lines with three back-ticks ( ```) but only the latter solution allows for syntax highlightning where it's supported so that it's considered "best practice"

Typing:

```js
console.log('This is JavaScript syntax highlighting!');
```

Will look like this below in Markdown:

console.log('This is JavaScript syntax highlighting!');
Tables

β€’ Tables in Markdown are a great way to organise your informations

Tables are not a part of Markdown spec, but thet are widely supported, and especially on GitHub

The creation of tables in Markdown looks exactly like drawing with dashes (-) and pipes (|)
You may also use colons to align columns.

Typing this:

| Head | of | Table |
| ------------ |:--------:| ------------ :|
| left-aligned | centered | right-aligned |
| left-aligned | centered | right-aligned |

Will look like this below in Markdown:

Head of Table
left-aligned centered right-aligned
left-aligned centered right-aligned

Tip: there are three best practices to remember

  • There must be at least 3 dashes separating each header cell. Colons to align columns count as dashes
  • The outer pipes (|) are optional
  • You can use inline Markdown in cells

This means typing this:

Markdown | Less | Pretty
--: | :-: | :--
_Still_ | renders | **nicely**
1 | 2 | 3

Will look like this below in Markdown:

Markdown Less Pretty
Still renders nicely
1 2 3
Images

β€’ Adding images in Markdown is quite the same as adding links

Adding images into Markdown uses the same syntax as for links with a "!" in front

Typing this:

![Markdown logo](http://bit.do/how-to-markdown)

Will give the result below in Markdown:

Tip: it works as well for animated gifs 🎬

Tip: to add a link to an image, you must combine image and link and use the following syntax

[![image](link to the image file)](url of the link on the image)

Note: just like in links, you can also add an "alt" text with this syntax ![text](href "alt")

Note: the links "reference style" system (see section 10) can also be used for images you'd have to use many times in a file

Backslash Escapes

β€’ Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown's formatting syntax

Typing this:

\*This is non-bold text between asterisks\*

Will look like this below in Markdown:

*This is non-bold text between asterisks*

This works for the following characters:
\ (backslash), `(backtick), * (asterisk), _ (underscore), {} (curly braces), [] (square braces), () (parenthses), # (hash mark), + (plus sign), - (minus sign, or hyphen), . (dot), ! (exclamation mark)

HTML in Markdown

β€’ As already seen, there are many occasions to use HTML in Markdown to create specific results
Here are a four more I use very often

- Undeline text with using the <ins>to be underlined text</ins> HTML tag

This is using a semantic tag in place of CSS, but that's the only way to get it right in Markdown 🀷

- Center text or titles or images (or animated gif pretty often in my case) with inserting the style attribute align="center" in your HTML tag

- Deal with YouTube videos

They cannot be directly added but you can add an image with a link to the video:

-- either with the usual Markdown syntax [![image](link to the image file)](url of the link on the image)

-- or with HTML tags <a> and <img> to access the "width" and "height" attributes to style the image

More details here

- Create tables of contents with inner links tag

There are two ways to do that:

-- using an <a> HTML tag to add a "name" attribute to each title,

-- adding a {#custom-id} to each title,

and then creating a simple link to each "name" attribute in your table of contents

More details here

Note: you can add HTML inside Markdown, but you cannot add Markdown inside HTML

Typing this:

<p>I want this text to be in **bold**</p>

Will look like this:

I want this text to be in **bold**

(No bold effect created since the Markdown was inside the HTML tag)

GitHub Flavored Markdown

β€’ GitHub being a big user of Markdown, it has its own version of the Markdown syntax called GitHub Flavored Markdown or simply GFM
Here are five main GFM features

- Task Lists

A task list mixes a list (ordered or unordered) with squared brackets and will look like HTML checkboxes

Typing this:

- [x] this is a "done" item
- [ ] this is a "to do" item

Will look like this:



- Usernames @mentions

Typing an @ symbol, followed by a username, will notify that person
You can also mention @teams within an organization

- Issues and Pull requests references

Any number that refers to an Issue or Pull Request will be automatically converted into a link

- SHA references

Any reference to a commit’s SHA-1 hash will be automatically converted into a link to that commit on GitHub

- Emojis

GFM supports emojis with this syntax: :star: will automatically turn into ⭐

More details in the links below:

Emoji Markdown cheatsheet with Search bar

Other Emoji Markdown cheatsheet

Contact

β€’ For any typo, comment, suggestion... please get in touch with me

Additional Resources

β€’ Markdown around the web 🌏