DEV Community

Cover image for Markdown Cheat Sheet
ishrat
ishrat

Posted on • Updated on

Markdown Cheat Sheet

Here's a basic Markdown cheat sheet to help you format text:

Markdown Cheat Sheet

Headers

# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6

Emphasis

*Italic* or _Italic_
**Bold** or __Bold__
***Bold and Italic*** or ___Bold and Italic___

Lists

Unordered List

- Item 1
- Item 2
  - Subitem 2.1
  - Subitem 2.2
- Item 3

Ordered List

1. First item
2. Second item
3. Third item
   1. Subitem 3.1
   2. Subitem 3.2

Links

[Link text](https://www.example.com)

Images

![Alt text](image-url)

Blockquotes

> This is a blockquote.

## Code

Inline Code

`Inline code`

Code Block


python
def example_function():
print("Hello, Markdown!")

Horizontal Rule

   ---
Enter fullscreen mode Exit fullscreen mode

Tables

| Header 1 | Header 2 |
| ---------|----------|
| Row 1, Col 1 | Row 1, Col 2 |
| Row 2, Col 1 | Row 2, Col 2 |

Escaping Characters

To display special characters literally, use a backslash \ before the character.

\*This is not italic\*

Task Lists

- [x] Completed task
- [ ] Incomplete task
- [ ] Another incomplete task

Strikethrough

~~Strikethrough text~~

Fenced Code Blocks

Specify the programming language after the three backticks for syntax highlighting:


javascript
console.log("Hello, Markdown!");

Footnotes

Here is some text with a footnote[^1].
[^1]: This is the footnote.

Definition Lists

Term 1
: Definition 1
Term 2
: Definition 2

Abbreviations

The HTML specification[^HTML] is maintained by the W3C.
[^HTML]: Hypertext Markup Language

Superscript and Subscript

Superscript: 2^10^
Subscript: H~2~O

LaTeX Math

Enclose LaTeX math expressions between dollar signs:

$E=mc^2$

Emoji

:smile: :star: :computer:

Automatic Links

<https://www.example.com>

Block-Level HTML

You can also use HTML directly in Markdown:

<div style="background-color: lightblue; padding: 10px;">
  This is a block-level HTML element in Markdown.
</div>

Markdown provides a variety of features, and these examples cover some additional elements. Feel free to explore and experiment with Markdown to suit your specific needs!

Top comments (0)