Skip to content

Instantly share code, notes, and snippets.

@Myndex
Forked from joshuapekera/markdown
Last active September 22, 2023 20:45
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
GitHub Flavored Markdown Cheat Sheet

What's Up With Markdown

GitHub Flavored Markdown Cheat Sheet

This is intended as a quick reference and showcase. For more complete info, see John Gruber's original spec and the Github-flavored Markdown info page.

This cheatsheet is modified from Joshua Pekera'a cheat sheet for "Markdown Here", but this is just GitHub Flavored Markdown

Table of Contents

Headers
Emphasis
Lists
Links
Images
Code and Syntax Highlighting
Tables
Blockquotes
Inline HTML
Horizontal Rule
Line Breaks

Headers

For H1 and H2, an underline-ish style:

Alt-H1
======

Alt-H2
------

Or the more common 

# H1
## H2
### H3
#### H4
##### H5
###### H6

For H1 and H2, an underline-ish style:

Alt-H1

Alt-H2

Or the more common

H1

H2

H3

H4

H5
H6

Emphasis

Emphasis, aka italics, with *asterisks* or _underscores_.

Strong emphasis, aka bold, with **asterisks** or __underscores__.

Combined emphasis with **asterisks and _underscores_**.

Strikethrough uses two tildes. ~~Scratch this.~~

Emphasis, aka italics, with asterisks or underscores.

Strong emphasis, aka bold, with asterisks or underscores.

Combined emphasis with asterisks and underscores.

Strikethrough uses two tildes. Scratch this.


Lists

1. First ordered list item
2. Another item
    * Unordered sub-list, lead with 4 spaces
1. Actual numbers don't matter, just that it's a number
    1. Ordered sub-list, lead with 4 spaces
        1. More sub, lead with 4 spaces
            3. Notice how the numbers can get janky
            1. Notice how the numbers can get janky
        2. previous sub
    2. previous sub
4. And another item.


1. Main level
    1. second level
        1. third level
            - fourth level
        2. third level
    2. Second level
7. main level



Unordered list:

- This is a list
    - This is a sub list, lead with 4 spaces
        - and a further sublist, lead with 4 spaces
            - and still more subing
    - back down a few
    1. add in some ordered stuff
    3. more ordered stuff
        2. sub ordered stuff
            1. Hi There
- Back to the future
   
   Some text that should be aligned with the above item.

* Unordered list can use asterisks
- Or minuses
+ Or pluses
  1. First ordered list item

  2. Another item

    • Unordered sub-list, lead with 4 spaces
  3. Actual numbers don't matter, just that it's a number

    1. Ordered sub-list, lead with 4 spaces
      1. More sub, lead with 4 spaces 3. Notice how the numbers can get janky
      2. previous sub
    2. previous sub
  4. And another item.

  5. Main level

    1. second level
      1. third level
        • fourth level
      2. third level
    2. Second level
  6. main level

Unordered list:

  • This is a list

    • This is a sub list, lead with 4 spaces
      • and a further sublist, lead with 4 spaces
        • and still more subing
    • back down a few
    1. add in some ordered stuff
    2. more ordered stuff 2. sub ordered stuff 1. Hi There
  • Back to the future

    Some text that should be aligned with the above item.

  • Unordered list can use asterisks
  • Or minuses
  • Or pluses

There are two ways to create links.

[I'm an inline-style link](https://www.google.com)

[I'm a reference-style link][Arbitrary case-insensitive reference text]

[You can use numbers for reference-style link definitions][1]

Or leave it empty and use the [link text itself][]

Some text to show that the reference links can follow later.

[arbitrary case-insensitive reference text]: https://git.myndex.com
[1]: http://www.myndex.com/APCA/
[link text itself]: http://www.myndex.com/CVD/

I'm an inline-style link

I'm a reference-style link

You can use numbers for reference-style link definitions

Or leave it empty and use the link text itself

Some text to show that the reference links can follow later.

Images

Here's a logo (hover to see the title text):

Inline-style: 
![don't forget to do alt text](https://avatars.githubusercontent.com/u/42009457?s=40&v=4 "Logo Title Hover Text")

Reference-style: 
![don't forget to do alt text, this is a logo][logo]

[logo]: https://avatars.githubusercontent.com/u/42009457?s=40&v=4 "Logo Title Hover Text: The Sequel"

And regular HTML allows setting the width or height:

<img width="200" alt="Hi There" src="https://avatars.githubusercontent.com/u/42009457?s=400&u=2dcba5c146315f82f802b8b58e92a4d6b82344b3&v=4">

Here's a logo (hover to see the title text):

Inline-style: don't forget to do alt text

Reference-style: don't forget to do alt text, this is a logo

And regular HTML allows setting the width or height:

Hi There

Code and Syntax Highlighting

Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and Markdown Here -- support syntax highlighting. Markdown Here supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the highlight.js demo page.

Inline `code` has `back-ticks around` it.

Inline code has back-ticks around it.

Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.

    ```javascript
    var s = "JavaScript syntax highlighting";
    alert(s);
    ```
 
    ```python
    s = "Python syntax highlighting"
    print s
    ```
 
    ```
    No language indicated.
    let what = 'will it' + B;

    // let's throw in a comment
    <b>tag</b>.
    ```
var s = "JavaScript syntax highlighting";
alert(s);
s = "Python syntax highlighting"
print s
No language indicated.
let what = 'will it' + B;

// let's throw in a comment
<b>tag</b>.

Again, to see what languages are available for highlighting, and how to write those language names, see the highlight.js demo page.

Tables

Colons can be used to align columns.

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |

The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.

Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3

Colons can be used to align columns.

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.

Markdown Less Pretty
Still renders nicely
1 2 3

Blockquotes

>> Blockquotes are very handy in email to emulate reply text.
>> This line is part of the same quote.
> This is one less quote level
This line gets incorporated with the quote because it's only a single newline away

Quote break.

> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. 

Blockquotes are very handy in email to emulate reply text. This line is part of the same quote. This is one less quote level This line gets incorporated with the quote because it's only a single newline away

Quote break.

This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.

Inline HTML

You can also use raw HTML in your Markdown... sometimes:

<dl>
  <dt>Definition list</dt>
  <dd>Is something people use sometimes.</dd>

  <dt>Markdown in HTML</dt>
  <dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
Definition list
Is something people use sometimes.
Markdown in HTML
Does *not* work **very** well. Use HTML tags.

Horizontal Rule

Three or more...

---

Hyphens

***

Asterisks

___

Underscores

Three or more...


Hyphens


Asterisks


Underscores

Line Breaks

Here are some things to try out:

Here's a line for us to start with.

This line is separated from the one above by two newlines, so it will be a *separate paragraph*.

This line is also begins a separate paragraph, but,
despite having a single newline, it just gets wrapped together.

This line ends with four white spaces before hiting return.    
So the next line becomes a single new line

Here's a line for us to start with.

This line is separated from the one above by two newlines, so it will be a separate paragraph.

This line is also begins a separate paragraph, but, despite having a single newline, it just gets wrapped together.

This line ends with four white spaces before hiting return.
So the next line becomes a single new line

End For Now

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