Markdown is a lightweight markup language used by developers around the world to format plain text. Because it is simple to write and reads cleanly as source code, it has become the standard for README files, pull request descriptions, and technical documentation.
By understanding a few basic syntax rules, you can create beautifully formatted documents using any plain text editor.
Structuring headers and text
To create headings in Markdown, you prefix your heading text with hash symbols (#). The number of hashes determines the heading level, from h1 to h6.
# Document title (h1)
## Major section (h2)
### Sub-section (h3)
For emphasis, you can make text bold by wrapping it in double asterisks, or italic by using single asterisks.
This is **bold** text and this is *italic* text.
Using these simple formatting rules allows you to build hierarchy without writing verbose HTML tags.
Code blocks and inline formatting
Because Markdown is designed for technical writing, it has excellent support for displaying code. You can display inline code by wrapping text in single backticks.
To print a message, use the `print()` function.
For multi-line code examples, use code blocks by wrapping the code in triple backticks. You can also specify the programming language immediately after the first set of backticks to enable syntax highlighting.
```javascript
const greet = (name) => {
console.log(`Hello, ${name}`);
};
This formatting makes it easy for other developers to read and copy your code snippets without visual clutter.
## Lists and hyperlinks
Markdown supports both ordered and unordered lists. For bulleted lists, use asterisks or hyphens. For numbered lists, use regular numbers followed by periods.
```markdown
* First item
* Second item
Adding links is straightforward. You wrap the display text in square brackets, followed immediately by the URL in parentheses.
Read our [documentation](https://example.com/docs).
Combining lists and links allows you to construct clear navigation structures and resource indexes.
Practice writing Markdown
If you want to practice formatting text, headings, and code blocks, use our Markdown playground. It provides a live preview panel so you can see your formatted document render in real time as you type. For a condensed syntax reference, see our Markdown Cheatsheet.