RoboDOJO

Headers and Headings

Headers are the backbone of document structure in Markdown. They create hierarchy, improve readability, and help organize your content.

Basic Header Syntax

Markdown uses the # symbol to create headers. The number of # symbols determines the header level:

MARKDOWN
# Header 1 (Largest)

## Header 2

### Header 3

#### Header 4

##### Header 5

###### Header 6 (Smallest)

Visual Hierarchy

This is Header 1

This is Header 2

This is Header 3

This is Header 4

This is Header 5
This is Header 6

Alternative Syntax (Setext)

For H1 and H2, you can also use underlines:

MARKDOWN
# Header 1

## Header 2

Result: Header 1

Header 2

Note: Most people prefer the # syntax because it's more explicit and supports all six levels.

Best Practices

1. Logical Hierarchy

Always follow a logical structure:

Good structure:

MARKDOWN
# Main Title

## Section

### Subsection

#### Sub-subsection

# Another Main Section

## Another Section

Poor structure:

MARKDOWN
# Main Title

### Skipped H2 - confusing!

##### Skipped H4 - also confusing!

2. Consistent Spacing

Add consistent spacing around headers:

MARKDOWN
Previous paragraph content.

## New Section Header

First paragraph of new section.

3. Descriptive Headers

Make headers descriptive and scannable:

Good:

MARKDOWN
## Installation Requirements

## Step-by-Step Setup Guide

## Troubleshooting Common Issues

Vague:

MARKDOWN
## Setup

## How To

## Problems

Advanced Header Features

Table of Contents Generation

Many Markdown processors automatically generate tables of contents from headers:

MARKDOWN
# Document Title

## Table of Contents

- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [Advanced Features](#advanced-features)

## Introduction

Content here...

## Getting Started

Content here...

## Advanced Features

Content here...

Anchor Links

Headers automatically become anchor links:

MARKDOWN
## My Section Header

Becomes accessible via:

CODE
https://example.com/page#my-section-header

Custom IDs (Extended Syntax)

Some processors support custom header IDs:

MARKDOWN
## My Header {#custom-id}

Document Structure Examples

Technical Documentation

MARKDOWN
# API Documentation

## Authentication

### Bearer Tokens

### API Keys

## Endpoints

### User Management

#### Get User

#### Create User

#### Update User

#### Delete User

### Data Operations

#### Query Data

#### Insert Data

#### Update Data

## Error Handling

### HTTP Status Codes

### Error Response Format

Tutorial Structure

MARKDOWN
# Complete React Tutorial

## Prerequisites

### Node.js Installation

### Code Editor Setup

## Getting Started

### Creating Your First App

### Understanding Components

## Core Concepts

### State Management

### Props and Data Flow

### Event Handling

## Advanced Topics

### Hooks

### Context API

### Performance Optimization

## Deployment

### Build Process

### Hosting Options

Blog Post Structure

MARKDOWN
# The Ultimate Guide to Remote Work

## Introduction

## The Remote Work Revolution

### Statistics and Trends

### Benefits for Companies

### Benefits for Employees

## Setting Up Your Home Office

### Essential Equipment

### Ergonomic Considerations

### Creating Boundaries

## Productivity Strategies

### Time Management

### Communication Tools

### Avoiding Distractions

## Challenges and Solutions

### Isolation and Loneliness

### Work-Life Balance

### Technical Issues

## Conclusion

Styling and Formatting

Adding Emphasis

Combine headers with other formatting:

MARKDOWN
## 🚀 **Getting Started** with Markdown

### ⚠️ Important: Prerequisites

#### 💡 Pro Tip: Best Practices

Long Headers

For very long headers, consider breaking them:

Too long:

MARKDOWN
## How to Set Up a Complete Development Environment with Node.js, React, and All the Necessary Tools for Modern Web Development

Better:

MARKDOWN
## Development Environment Setup

### Node.js and React Installation

### Essential Tools Configuration

SEO and Accessibility

SEO Benefits

Proper header structure helps with search engine optimization:

  • H1: Main page topic (use only one per page)
  • H2-H6: Organize content hierarchy
  • Keywords: Include relevant keywords naturally

Accessibility

Headers help screen readers navigate content:

MARKDOWN
# Page Title (H1 - Main topic)

## Main Sections (H2 - Primary divisions)

### Subsections (H3 - Secondary divisions)

Common Mistakes

1. Multiple H1s

Avoid:

MARKDOWN
# Introduction

# Getting Started

# Conclusion

Better:

MARKDOWN
# Complete Guide to Markdown

## Introduction

## Getting Started

## Conclusion

2. Skipping Levels

Avoid:

MARKDOWN
# Main Title

### Skipped H2

Better:

MARKDOWN
# Main Title

## Section Title

### Subsection Title

3. Headers for Styling

Don't use headers just for big text:

MARKDOWN
## This text just needs to be big

Use headers for structure:

MARKDOWN
## Important Section

Platform-Specific Features

GitHub

  • Automatic table of contents in README files
  • Hover links appear next to headers
  • Supports emoji in headers: ## 🎉 Celebration

GitLab

  • Similar to GitHub
  • Supports header anchors
  • Table of contents generation

Notion

  • Headers become toggleable sections
  • Automatic outline generation
  • Supports inline comments

Headers are your content's skeleton – use them wisely to create clear, navigable, and professional documents!