Home Markdown Cheat Sheet
Post
Cancel

Markdown Cheat Sheet

Learning From markdownguide.org

What is Markdown?

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.

Using Markdown is different than using a WYSIWYG editor. In an application like Microsoft Word, you click buttons to format words and phrases, and the changes are visible immediately. Markdown isn’t like that. When you create a Markdown-formatted file, you add Markdown syntax to the text to indicate which words and phrases should look different.

For example, to denote a heading, you add a number sign before it (e.g., # Heading One). Or to make a phrase bold, you add two asterisks before and after it (e.g., this text is bold). It may take a while to get used to seeing Markdown syntax in your text, especially if you’re accustomed to WYSIWYG applications. The screenshot below shows a Markdown file displayed in the Visual Studio Code text editor.

You can add Markdown formatting elements to a plaintext file using a text editor application. Or you can use one of the many Markdown applications for macOS, Windows, Linux, iOS, and Android operating systems. There are also several web-based applications specifically designed for writing in Markdown.

Depending on the application you use, you may not be able to preview the formatted document in real time. But that’s okay. According to Gruber, Markdown syntax is designed to be readable and unobtrusive, so the text in Markdown files can be read even if it isn’t rendered.

The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions.

Why Use Markdown?

You might be wondering why people use Markdown instead of a WYSIWYG editor. Why write with Markdown when you can press buttons in an interface to format your text? As it turns out, there are several reasons why people use Markdown instead of WYSIWYG editors.

  • Markdown can be used for everything. People use it to create websites, documents, notes, books, presentations, email messages, and technical documentation.

  • Markdown is portable. Files containing Markdown-formatted text can be opened using virtually any application. If you decide you don’t like the Markdown application you’re currently using, you can import your Markdown files into another Markdown application. That’s in stark contrast to word processing applications like Microsoft Word that lock your content into a proprietary file format.

  • Markdown is platform independent. You can create Markdown-formatted text on any device running any operating system.

  • Markdown is future proof. Even if the application you’re using stops working at some point in the future, you’ll still be able to read your Markdown-formatted text using a text editing application. This is an important consideration when it comes to books, university theses, and other milestone documents that need to be preserved indefinitely.

  • Markdown is everywhere. Websites like Reddit and GitHub support Markdown, and lots of desktop and web-based applications support it.


Basic Syntax

All Markdown applications should support following elements:

Text

ElementMarkdown SyntaxDisplay
Bold**Bold Text**Bold Text
Italic*Italic Text*Italic Text
Bold and Italic***Bold and Italic Text***Bold and Italic Text
Strikethrough~~Strikethrough Text~~Strikethrough Text
Highlight==Highlight Text==Highlight Text
SubscriptH~2~OH2O
SuperscriptX^2^X2
Code`Code Text`Code Text
Emoji listKeep the fingers crossed :crossed_fingers:Keep the fingers crossed :crossed_fingers:

Lists

ElementMarkdown SyntaxDisplay
Ordered1. First item
2. Second item
 1. Indented item
 2. Indented item
3. Thrid item
1. First item
2. Second item
 1. Indented item
 2. Indented item
3. Thrid item
Unordered- First item
+ Second item
* Third item
● First item
○ Second item
■ Third item
DescriptionJason Leung
: The Author
Jason Leung
 The Author

ElementMarkdown SyntaxDisplay
Automatic URLhttps://www.jasonlws.com/https://www.jasonlws.com/
Disabling Automatic URL`https://www.jasonlws.com/`https://www.jasonlws.com/
URL with Title[jasonlws](https:///www.jasonlws.com/)jasonlws
URL with Image[![J](/j.png 'J')](https://www.jasonlws.com/)J
Email<jason.leung.ws@gmail.com>jason.leung.ws@gmail.com

Headings

ElementMarkdown SyntaxDisplay
Heading Level 1# Heading Level 1

Heading Level 1

Heading Level 2## Heading Level 2

Heading Level 2

Heading Level 3### Heading Level 3

Heading Level 3

Heading Level 4#### Heading Level 4

Heading Level 4

Heading Level 5##### Heading Level 5
Heading Level 5
Heading Level 6###### Heading Level 6
Heading Level 6

Table

1
2
3
| First Column | Second Column | Third Column |
| :--- | :----: | ---: |
| Left| Center| Right|

Display:

First ColumnSecond ColumnThird Column
LeftCenterRight

Horizontal Rule

1
---

Display:



Images

Image

1
![J](j_icon.png)

Display:

J

Image with caption

1
2
![J](j_icon.png)
*It is a J icon*

Display:

J It is a J icon


Footnotes

1
2
3
If you think you can, you can. And if you think you can't, you're right.[^bestquote]
##### Reverse Footnote
[^bestquote]: By Henry Ford

Display:

If you think you can, you can. And if you think you can't, you're right.1

Reverse Footnote
  1. By Henry Ford 


Task List

Markdown Syntax:

1
2
3
4
- [x] Task 1
  + [ ] Subtask 1.1
- [ ] Task 2
  + [x] Subtask 2.1

Display:

  • Task 1
    • Subtask 1.1
  • Task 2
    • Subtask 2.1

Blackquotes

Blackquotes with single paragraphs

Markdown Syntax:

1
> If you think you can, you can. And if you think you can't, you're right.

Display:

If you think you can, you can. And if you think you can’t, you’re right.

Blackquotes with multiple paragraphs

Markdown Syntax:

1
2
3
> If you think you can, you can. And if you think you can't, you're right.
>
> By Henry Ford

Display:

If you think you can, you can. And if you think you can’t, you’re right.

By Henry Ford

Nested Blackquotes

Markdown Syntax:

1
2
> If you think you can, you can. And if you think you can't, you're right.
>> By Henry Ford

Display:

If you think you can, you can. And if you think you can’t, you’re right.

By Henry Ford


For Chirpy Jekyll Theme

Jekyll is a static site generator that takes Markdown files and converts them to a website. Jekyll is a free and open-source application written in the Ruby programming language. Thousands of websites rely on Jekyll to convert Markdown source files to HTML output. GitHub Pages uses Jekyll as the backend for its free website creation service.

Images

Image with size

1
![J](j_icon.png){: width="64" height="64" .normal}

Display:

J

Image with float

1
2
![J](j_icon.png){: width="64" height="64" .w-50 .normal}
It is a J icon

Display:

J It is a J icon


Prompts

1
2
3
4
5
6
7
8
9
10
11
> An example showing the `tip` type prompt.
{: .prompt-tip }

> An example showing the `info` type prompt.
{: .prompt-info }

> An example showing the `warning` type prompt.
{: .prompt-warning }

> An example showing the `danger` type prompt.
{: .prompt-danger }

Display:

An example showing the tip type prompt.

An example showing the info type prompt.

An example showing the warning type prompt.

An example showing the danger type prompt.


Fenced Code Blocks

Common

1
2
3
```
Common Fenced Code Block
```

Display:

1
Common Fenced Code Block

Specific Language

1
2
3
```markdown
# Specific Language Fenced Code Block Heading Level 1
```

Display:

1
# Specific Language Fenced Code Block Heading Level 1

Specific filename

1
2
3
4
```markdown
# Specific filename Fenced Code Block Heading Level 1
```
{: file='_md/specific_filename.md'}

Display:

1
# Specific filename Fenced Code Block Heading Level 1

Mathematics

Markdown Syntax:

1
2
3
4
5
6
7
The mathematics powered by [**MathJax**](https://www.mathjax.org/):

$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$

When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are

$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$

Display:

The mathematics powered by MathJax:

\[\sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6}\]

When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are

\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}\]

Mermaid SVG

Markdown Syntax:

1
2
3
4
5
6
7
```mermaid
 gantt
  title  Adding GANTT diagram functionality to mermaid
  Jason :a, 2023-03-01, 2w
  jasonlws :crit, b, 2023-03-08, 3d
  Jason Leung :active, c, after b a, 3d
```

Display:

 gantt
  title  Adding GANTT diagram functionality to mermaid
  Jason :a, 2023-03-01, 2w
  jasonlws :crit, b, 2023-03-08, 3d
  Jason Leung :active, c, after b a, 3d

References

About Myself

Please reach out to connect with me via Linkedin.

This post is licensed under CC BY 4.0 by the author.