Writing Pages¶
Learn how to write great documentation using Markdown in MkDocs.
Markdown Basics¶
Headers¶
Header Best Practices
- Use only one H1 per page (the page title)
- Don't skip header levels (don't go from H2 to H4)
- Keep headers descriptive and scannable
Paragraphs and Line Breaks¶
This is a paragraph. Just write normally with a blank line between paragraphs.
This is a new paragraph. To create a line break within a paragraph,
add two spaces at the end of the line.
Emphasis¶
*italic text* or _italic text_
**bold text** or __bold text__
***bold and italic***
~~strikethrough~~
`inline code`
italic text, bold text, bold and italic, strikethrough, inline code
Lists¶
Unordered lists:
Ordered lists:
Task lists:
- Completed task
- Incomplete task
- Another task
Links¶
[Link text](https://example.com)
[Internal link](../getting-started/quick-start.md)
[Link with title](https://example.com "Hover text")
Images¶
Images can be:
- Relative paths: ../img/image.png
- Absolute paths: /img/image.png
- External URLs: https://example.com/image.png
Code Blocks¶
Basic code block:
With line numbers:
Highlight specific lines:
```python hl_lines="2 3"
def example():
important_line = True # This line is highlighted
another_one = 42 # This too
return important_line
```
Blockquotes¶
This is a blockquote.
It can span multiple lines.
Horizontal Rules¶
Tables¶
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Row 1 | Data | More |
| Row 2 | Data | More |
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Row 1 | Data | More |
| Row 2 | Data | More |
Alignment:
| Left | Center | Right |
|---|---|---|
| L | C | R |
Admonitions (Callout Boxes)¶
Create eye-catching callouts:
!!! note
This is a note.
!!! tip "Custom Title"
This tip has a custom title!
!!! warning
Be careful here!
!!! danger "Critical Warning"
This is dangerous!
!!! info
Additional information.
!!! success
Operation completed successfully!
Note
This is a note.
Custom Title
This tip has a custom title!
Warning
Be careful here!
Collapsible Admonitions¶
??? note "Click to expand"
This content is hidden by default.
???+ tip "Expanded by default"
This starts expanded.
Click to expand
This content is hidden by default.
Page Metadata¶
Add metadata at the top of any page:
---
title: Custom Page Title
description: This appears in search results
hide:
- navigation
- toc
---
# Page Content
Metadata options:
- title: Override page title
- description: SEO description
- hide: Hide navigation or table of contents
- template: Use custom template
Internal Links¶
Linking to Pages¶
Linking to Headers¶
[Jump to Admonitions](#admonitions-callout-boxes)
[Configuration Guide](../getting-started/configuration.md#basic-configuration)
Automatic Reference Links¶
Organizing Content¶
Directory Structure¶
docs/
├── index.md # Homepage
├── getting-started/
│ ├── index.md # Section overview
│ ├── installation.md
│ └── quick-start.md
├── tutorials/
│ ├── beginner/
│ │ └── first-tutorial.md
│ └── advanced/
│ └── advanced-topic.md
└── reference/
└── api.md
Section Index Pages¶
Create index.md in each section:
# Getting Started
Welcome to the getting started guide!
## Contents
- [Installation](installation.md)
- [Quick Start](quick-start.md)
- [Configuration](configuration.md)
Content Best Practices¶
1. Start with a Clear Title¶
# Installing PostgreSQL on Ubuntu
This guide walks you through installing and configuring PostgreSQL 15
on Ubuntu 22.04 LTS.
2. Use an Introduction Paragraph¶
Tell readers what they'll learn:
In this tutorial, you'll learn how to:
- Install PostgreSQL from official repositories
- Configure basic security settings
- Create your first database
- Set up automatic backups
3. Break Content into Sections¶
## Prerequisites
Before you begin, ensure you have:
- Ubuntu 22.04 LTS
- Sudo privileges
- 2GB available disk space
## Step 1: Update Package Lists
First, update your package lists...
4. Use Visual Hierarchy¶
5. Add Examples¶
Show, don't just tell:
You'll see output like:
Adding user `johndoe' ...
Adding new group `johndoe' (1001) ...
Adding new user `johndoe' (1001) with group `johndoe' ...
### 6. Include Screenshots
```markdown
After clicking "Submit", you should see:

7. Link to Related Content¶
!!! info "Related Reading"
- [Configuration Guide](../getting-started/configuration.md)
- [Advanced Topics](../advanced/overview.md)
8. Provide Next Steps¶
## Next Steps
Now that you've completed installation:
1. [Configure your database](configuration.md)
2. [Create your first schema](first-schema.md)
3. [Learn backup strategies](backups.md)
Writing Style Tips¶
Keep It Simple¶
Be Specific¶
Use Active Voice¶
Address the Reader¶
Common Patterns¶
Command Line Instructions¶
You should see output like:
### Step-by-Step Tutorials
```markdown
## Step 1: Install Dependencies
Install the required packages:
```bash
pip install -r requirements.txt
Step 2: Configure Settings¶
Edit config.yml and set your API key:
Step 3: Test the Setup¶
Run the test command:
### API Documentation
```markdown
## authenticate()
Authenticates a user with username and password.
**Parameters:**
- `username` (str): User's username
- `password` (str): User's password
**Returns:**
- `token` (str): Authentication token
**Example:**
```python
token = authenticate("user@example.com", "secret123")
print(f"Token: {token}")
### Troubleshooting Sections
```markdown
## Troubleshooting
### "Permission Denied" Error
If you see:
Port Already in Use¶
Problem: Port 8000 is already in use.
Solution: Use a different port:
## Page Templates
### Tutorial Template
```markdown
# Tutorial Title
Brief introduction explaining what this tutorial covers.
**Time required:** 15 minutes
**Difficulty:** Beginner
## What You'll Learn
- Skill 1
- Skill 2
- Skill 3
## Prerequisites
- Requirement 1
- Requirement 2
## Step 1: [Action]
Instructions...
## Step 2: [Action]
Instructions...
## Conclusion
Summary of what was learned.
## Next Steps
- Related tutorial 1
- Related tutorial 2
Reference Page Template¶
# Component Name
Brief description of the component.
## Overview
Detailed explanation...
## Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| name | str | None | User's name |
| age | int | 0 | User's age |
## Methods
### method_name()
Description of what the method does.
## Examples
```python
# Example usage
See Also¶
- Related component 1
- Related component 2 ```
Next Steps¶
- Markdown Tips - Advanced Markdown features
- Code Blocks - Syntax highlighting and more
- Diagrams - Add visual diagrams
Happy writing! ✍️