Skip to content

Instantly share code, notes, and snippets.

@Robert-96
Last active April 2, 2023 16:50
Show Gist options
  • Save Robert-96/048fddefc20e6860aeca6949a2443adf to your computer and use it in GitHub Desktop.
Save Robert-96/048fddefc20e6860aeca6949a2443adf to your computer and use it in GitHub Desktop.
Github Markdown Cheat Sheet

Github Markdown Cheat Sheet

Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. Created by John Gruber in 2004, Markdown is now one of the world’s most popular markup languages.

Headers

# This is an <h1> tag
  
## This is an <h2> tag 

### This is an <h3> tag   
  
#### This is an <h4> tag 
  
##### This is an <h5> tag
  
###### This is an <h6> tag

This is an <h1> tag

This is an <h2> tag

This is an <h3> tag

This is an <h4> tag

This is an <h5> tag
This is an <h6> tag

Emphasis

*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

~~This text will be crossed out (strikethrough)~~ 

_You **can** combine them_

***All this text is bold and italic***

This text will be italic This will also be italic

This text will be bold This will also be bold

This text will be crossed out (strikethrough)

You can combine them

All this text is bold and italic

Lists

Unordered

* Item 1
* Item 2
  * Item 2a
  * Item 2b
  • Item 1
  • Item 2
    • Item 2a
    • Item 2b
- Item 1
- Item 2
  - Item 2a
  - Item 2b
  • Item 1
  • Item 2
    • Item 2a
    • Item 2b

Ordered

1. Item 1
1. Item 2
1. Item 3
   1. Item 3a
   1. Item 3b
  1. Item 1
  2. Item 2
  3. Item 3
    1. Item 3a
    2. Item 3b

Images

Format:  ![Alt Text](url)
Example: ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)

Image of Yaktocat

Links

http://github.com - automatic!

http://github.com - automatic!

Format:  [Test](url)
Example: [GitHub](http://github.com)

GitHub

Blockquotes

As Kanye West said:

> We're living the future so
> the present is our past.

As Kanye West said:

We're living the future so the present is our past.

Blockquotes can be nested.

> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

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

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Horizontal Rules

Horizontal rules can be created using three or more asterisks (***), dashes (---), or underscores (___) on a line by themselves.

*** 
----
______



Inline code

I think you should use an `<addr>` element here instead.

I think you should use an <addr> element here instead.

Fenced Code Blocks

No highlighting

```
if (isAwesome){
  return true
}
```
if (isAwesome) {
  return true
}

Highlighting

```javascript 
if (isAwesome){
  return true
}
```
if (isAwesome) {
  return true
}

Tabels

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |
First Header Second Header
Content Cell Content Cell
Content Cell Content Cell
| Left-aligned | Center-aligned | Right-aligned |
| :---         |     :---:      |          ---: |
| git status   | git status     | git status    |
| git diff     | git diff       | git diff      |
Left-aligned Center-aligned Right-aligned
git status git status git status
git diff git diff git diff

Your Markdown does't have to be pretty.

There must be at least 3 dashes separating each header cell. The outer pipes (|) are optional, and you don't need to make the table columns line up prettily.

Less | Pretty | Markdown 
--- | --- | ---
1 | 2 | 3 
*Still* | `renders` | **as expected**
4 | 5 | 6
Less Pretty Markdown
1 2 3
Still renders as expected
4 5 6

Blackslash escape

Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formating syntax.

Name Markdown Result
backslash \\ \
backtick \` `
asterisk \* *
underscore \_ _
curly braces \{\} {}
square brackets \[\] [ ]
parentheses \(\) ()
hash mark \# #
plus sign \+ +
minus sign (hyphen) \- -
dot \. .
exclamation mark \! !

Task Lists

- [x] this is a complete item 
- [ ] this is an incomplete it
  • this is a complete item
  • this is an incomplete it

Inline HTML

Markdown also supports raw HTML.

<dl>
  <dt>First Term</dt>
  <dd>This is the definition of the first term.</dd>
  <dt>Second Term</dt>
  <dd>This is one definition of the second term. </dd>
  <dd>This is another definition of the second term.</dd>
</dl>
First Term
This is the definition of the first term.
Second Term
This is one definition of the second term.
This is another definition of the second term.
<p>Markdown and HTML does *not* work **well**. Use <i>HTML</i> <b>tags</b> instead.</p>

Markdown in HTML does *not* work **well**. Use HTML tags instead.

Emoji

:+1: :sparkles: :camel: :tada: :rocket: :metal:

👍 ✨ 🐫 🎉 🚀 🤘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment