Markdown Cheatsheet

2020-04-18

This article is a bit old and the content may be outdated, so please refer to it with caution and remember to check the latest official materials (such as documentation, etc.)

Tricks that are less known to GitHub-flavored markdown starters, including escaping `s, writing dropdowns, and centering an image.

Escaping ` #

The general principle is, escape ` with more `s.

For example, if you want to escape a single `, just wrap it with two on each side, and add spaces, that is, `` ` ``.

If you want to escape three back quotes in a code block, use 4 for the code fence:

````
```python
print('hello')
```
````
text

Produces:

```python
print('hello')
```
text

Awesome Dropdown! #

Write Markdown!

Python Code

from __future__ import print_function
print('Hello world!')
python
Raw code
<details open>
<summary>Write Markdown!</summary>
<!--All you need is a blank line-->

**Python** *Code*
````python
from __future__ import print_function
print('Hello world!')
```
</details>
html

Reference: https://github.github.com/gfm/#html-block

The trick is, that the blank line terminates the HTML block

Center an Image in GFM #

Use HTML tag p with align to wrap img

<p align="center">
  <img alt="GitHub fluid icon" width="100" src="https://github.com/fluidicon.png">
</p>
html

GitHub fluid icon

Leave your comments and reactions on GitHub