π Documentation Style Guide¶
Last Updated: 2025-01-22 | Version: 1.0
Status: β Final | Maintainer: Documentation Team
π Table of Contents¶
- Overview
- Document Structure
- Visual Elements
- Mermaid Diagrams
- Icons & Emoji
- Code Blocks
- Tables
- Links & Navigation
- Images & Media
- Templates
- Quick Reference
π― Overview¶
This guide establishes visual and structural standards for all documentation in this repository. Following these standards ensures:
| Benefit | Description |
|---|---|
| π§ Easy Navigation | Breadcrumbs, TOC, and backlinks help readers find content |
| ποΈ Visual Clarity | Icons, diagrams, and formatting improve readability |
| π Consistency | Uniform styling across all documents |
| π± Accessibility | Works well on different devices and with screen readers |
Design Principles¶
mindmap
root((Documentation))
Scannable
Headers
Tables
Bullet Points
Visual
Icons
Diagrams
Color Coding
Navigable
Breadcrumbs
TOC
Backlinks
Consistent
Templates
Naming
Formatting π Document Structure¶
Required Elements¶
Every documentation file MUST include these elements in order:
[Breadcrumb Navigation]
# π Title with Icon
> **Last Updated**: YYYY-MM-DD | **Author/Maintainer**: Name
> **Status**: Draft | Review | Final
---
## π Table of Contents (if > 3 sections)
- [Section 1](#section-1)
- [Section 2](#section-2)
---
## Section Content...
---
## π Related Documents (at end)
Header Format¶
[Home](index.md) > [Parent Section](./index.md) > Current Page
# π·οΈ Document Title
> **Last Updated**: 2025-01-22 | **Author**: Your Name
> **Status**: Draft | Review | Final
Section Headers¶
| Level | Usage | Icon Placement |
|---|---|---|
# H1 | Document title only | Always include icon |
## H2 | Major sections | Include icon |
### H3 | Subsections | Optional icon |
#### H4 | Minor points | No icon needed |
Example:
# π Getting Started β Document title
## π¦ Installation β Major section
### Prerequisites β Subsection
#### Node.js Version β Minor detail
π¨ Visual Elements¶
Callout Boxes¶
Use blockquotes with icons for important callouts:
> β οΈ **Warning**: This action cannot be undone.
> π‘ **Tip**: Use keyboard shortcuts for faster navigation.
> π **Note**: This feature requires version 2.0 or higher.
> β **Error**: Connection failed. Check your network settings.
> β
**Success**: Your changes have been saved.
Rendered Examples:
β οΈ Warning: This action cannot be undone.
π‘ Tip: Use keyboard shortcuts for faster navigation.
π Note: This feature requires version 2.0 or higher.
Status Badges¶
Use inline badges for status indicators:
| Badge Type | Markdown | Rendered |
|---|---|---|
| Status |  | Status: Active |
| Version |  | Version: 1.0.0 |
| Build |  | Build: Passing |
Or use simple text badges:
Progress Indicators¶
For tracking document or feature status:
| Feature | Status |
| -------------- | -------------- |
| Authentication | β
Complete |
| API Layer | π§ In Progress |
| Testing | β³ Pending |
| Documentation | β Blocked |
π Mermaid Diagrams¶
When to Use Each Type¶
| Diagram Type | Best For | Example Use |
|---|---|---|
| Flowchart | Processes, decisions | User flows, algorithms |
| Sequence | Interactions over time | API calls, auth flows |
| Class | Object relationships | Data models, architecture |
| State | State machines | Workflow states |
| ER | Database schema | Data relationships |
| Gantt | Timelines | Project schedules |
| Mindmap | Concepts hierarchy | Feature breakdown |
| Git Graph | Branch strategy | Release workflows |
Flowchart Examples¶
Basic Flow:
```mermaid
flowchart LR
A[Start] --> B{Decision?}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
```
flowchart LR
A[Start] --> B{Decision?}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E Styled Flow with Colors:
```mermaid
flowchart TD
A[π₯ Input] --> B[π Process]
B --> C{β
Valid?}
C -->|Yes| D[πΎ Save]
C -->|No| E[β Error]
D --> F[π€ Output]
E --> A
style A fill:#e3f2fd
style B fill:#fff3e0
style C fill:#f3e5f5
style D fill:#e8f5e9
style E fill:#ffebee
style F fill:#e0f7fa
```
flowchart TD
A[π₯ Input] --> B[π Process]
B --> C{β
Valid?}
C -->|Yes| D[πΎ Save]
C -->|No| E[β Error]
D --> F[π€ Output]
E --> A
style A fill:#e3f2fd
style B fill:#fff3e0
style C fill:#f3e5f5
style D fill:#e8f5e9
style E fill:#ffebee
style F fill:#e0f7fa Sequence Diagram Example¶
```mermaid
sequenceDiagram
participant U as π€ User
participant C as π» Client
participant A as π Auth API
participant D as ποΈ Database
U->>C: Login Request
C->>A: POST /auth/login
A->>D: Validate Credentials
D-->>A: User Record
A-->>C: JWT Token
C-->>U: Logged In β
```
sequenceDiagram
participant U as π€ User
participant C as π» Client
participant A as π Auth API
participant D as ποΈ Database
U->>C: Login Request
C->>A: POST /auth/login
A->>D: Validate Credentials
D-->>A: User Record
A-->>C: JWT Token
C-->>U: Logged In β
Architecture Diagram¶
```mermaid
graph TB
subgraph Frontend["π₯οΈ Frontend"]
R[React App]
N[Next.js]
end
subgraph Backend["βοΈ Backend Services"]
A[API Gateway]
S1[Auth Service]
S2[Data Service]
end
subgraph Data["ποΈ Data Layer"]
DB[(PostgreSQL)]
C[(Redis Cache)]
end
R --> A
N --> A
A --> S1
A --> S2
S1 --> DB
S2 --> DB
S2 --> C
```
graph TB
subgraph Frontend["π₯οΈ Frontend"]
R[React App]
N[Next.js]
end
subgraph Backend["βοΈ Backend Services"]
A[API Gateway]
S1[Auth Service]
S2[Data Service]
end
subgraph Data["ποΈ Data Layer"]
DB[(PostgreSQL)]
C[(Redis Cache)]
end
R --> A
N --> A
A --> S1
A --> S2
S1 --> DB
S2 --> DB
S2 --> C Git Graph Example¶
```mermaid
gitGraph
commit id: "Initial"
branch develop
commit id: "Setup"
branch feature/auth
commit id: "Add login"
commit id: "Add JWT"
checkout develop
merge feature/auth tag: "v0.1.0"
checkout main
merge develop tag: "v1.0.0"
```
π·οΈ Icons & Emoji¶
Standard Icon Set¶
Use these consistently throughout documentation:
Status Icons¶
| Icon | Meaning | Usage |
|---|---|---|
| β | Complete/Success | Finished items, passed tests |
| β | Error/Failed | Failed items, errors |
| β οΈ | Warning | Important cautions |
| π§ | In Progress | Work in progress |
| β³ | Pending/Waiting | Queued items |
| π | Refresh/Sync | Update operations |
| βΈοΈ | Paused | Temporarily stopped |
Content Icons¶
| Icon | Meaning | Usage |
|---|---|---|
| π | Folder/Directory | File structure |
| π | File/Document | Single file reference |
| π | Note/Edit | Notes, edits |
| π‘ | Tip/Idea | Helpful tips |
| π | Link | Cross-references |
| π | Documentation | Doc collections |
| π― | Goal/Target | Objectives |
| π | Launch/Start | Getting started |
Technical Icons¶
| Icon | Meaning | Usage |
|---|---|---|
| βοΈ | Settings/Config | Configuration |
| π | Security/Auth | Security topics |
| ποΈ | Database | Data storage |
| π | Network/Web | API, web topics |
| π³ | Docker | Container topics |
| βοΈ | Cloud | Cloud services |
| π¦ | Package | Dependencies |
| π§ | Tools | Utilities, CLI |
Icon Placement Rules¶
- Always use icon with H1 (document title)
- Usually use icon with H2 (major sections)
- Sometimes use icon with H3 (key subsections)
- Never overuse - 1 icon per header maximum
Good:
Bad:
π» Code Blocks¶
Syntax Highlighting¶
Always specify the language:
```typescript
const greeting: string = "Hello, World!";
console.log(greeting);
```
```python
greeting: str = "Hello, World!"
print(greeting)
```
```bash
echo "Hello, World!"
```
```json
{
"greeting": "Hello, World!"
}
```
Code with Line Numbers (for reference)¶
When discussing specific lines, use comments:
// Line 1: Import dependencies
import { useState, useEffect } from 'react';
// Line 3: Component definition
export function UserProfile({ userId }) {
// Line 5: State initialization
const [user, setUser] = useState(null);
// Line 8: Effect for fetching
useEffect(() => {
fetchUser(userId).then(setUser);
}, [userId]);
return <div>{user?.name}</div>;
}
Inline Code¶
Use backticks for:
- Function names:
useState() - Variable names:
userId - File names:
package.json - Commands:
npm install - Keyboard shortcuts:
Ctrl + S
π Tables¶
Standard Table Format¶
| Column 1 | Column 2 | Column 3 |
| -------- | -------- | -------- |
| Data 1 | Data 2 | Data 3 |
| Data 4 | Data 5 | Data 6 |
Alignment¶
| Left Aligned | Center Aligned | Right Aligned |
| :----------- | :------------: | ------------: |
| Text | Text | Numbers |
| More text | More text | 123 |
Feature Comparison Tables¶
| Feature | Free | Pro | Enterprise |
|---|---|---|---|
| Basic API | β | β | β |
| Advanced Analytics | β | β | β |
| Priority Support | β | β | β |
| Custom Integrations | β | β | β |
| SLA Guarantee | β | β | β |
Command Reference Tables¶
| Command | Description | Example |
|---|---|---|
npm start | Start dev server | npm start |
npm test | Run test suite | npm test -- --coverage |
npm build | Production build | npm run build |
π Links & Navigation¶
Breadcrumb Navigation¶
Always at document top:
Rendered:
Home > Docs > API > Authentication
Internal Links¶
See [Installation Guide](./guides/installation.md) for setup instructions.
Jump to [Configuration](#configuration) section.
Reference the [API docs](../docs/api/README.md).
External Links¶
- [React Documentation](https://react.dev/) - Official React docs
- [TypeScript Handbook](https://www.typescriptlang.org/docs/) - TS reference
Related Documents Section¶
Always end documents with:
---
## π Related Documents
| Document | Description |
|----------|-------------|
| [Getting Started](./getting-started.md) | Initial setup guide |
| [API Reference](./api/README.md) | Full API documentation |
| [Troubleshooting](./troubleshooting.md) | Common issues and solutions |
---
[β¬οΈ Back to Top](#-document-title) | [π All Docs](./index.md) | [π Home](index.md)
πΌοΈ Images & Media¶
Image Placement¶

_Figure 1: Caption describing what the image shows_
Image Guidelines¶
| Aspect | Guideline |
|---|---|
| Format | PNG for screenshots, SVG for diagrams |
| Size | Max 1920px width, optimize for web |
| Location | Store in docs/images/ or docs/diagrams/ |
| Naming | feature_description_v1.png |
| Alt Text | Always provide descriptive alt text |
Diagram Storage¶
docs/
βββ images/
β βββ screenshots/
β β βββ dashboard_overview.png
β βββ logos/
β βββ project_logo.svg
βββ diagrams/
βββ architecture.excalidraw
βββ architecture.svg
βββ data_flow.mmd
π Templates¶
New Document Template¶
[Home](index.md) > [Parent](./index.md) > Document Title
# π Document Title
> **Last Updated**: YYYY-MM-DD | **Author**: Your Name
> **Status**: Draft | Review | Final
Brief one-paragraph description of this document's purpose.
---
## π Table of Contents
- [Overview](#overview)
- [Section 1](#section-1)
- [Section 2](#section-2)
- [Related Documents](#-related-documents)
---
## Overview
Introduction to the topic...
---
## Section 1
Content...
---
## Section 2
Content...
---
## π Related Documents
| Document | Description |
| ----------------------------- | ----------- |
| [Related Doc 1](./related.md) | Description |
| [Related Doc 2](./other.md) | Description |
---
[β¬οΈ Back to Top](#-document-title) | [π Docs](./index.md) | [π Home](index.md)
API Endpoint Template¶
### `POST /api/v1/users`
Creates a new user account.
**Authentication**: Required π
**Request Body:**
```json
{
"email": "user@example.com",
"password": "securePassword123",
"name": "John Doe"
}
```
**Response:**
| Status | Description |
| ------ | ---------------------------- |
| `201` | β
User created successfully |
| `400` | β Validation error |
| `409` | β Email already exists |
**Example Response (201):**
```json
{
"id": "usr_123abc",
"email": "user@example.com",
"name": "John Doe",
"createdAt": "2025-01-22T10:30:00Z"
}
```
Troubleshooting Entry Template¶
### β Error: Connection Refused
**Symptoms:**
- Application fails to start
- Error message: `ECONNREFUSED 127.0.0.1:5432`
**Cause:**
Database server is not running or not accessible.
**Solution:**
1. Check if database is running:
```bash
docker ps | grep postgres
```
2. Start the database if needed:
```bash
docker-compose up -d db
```
3. Verify connection:
```bash
psql -h localhost -p 5432 -U postgres
```
**Related:**
- [Database Setup](./database-setup.md)
- [Docker Configuration](./docker.md)
π Quick Reference¶
Checklist for Every Document¶
- Breadcrumb navigation at top
- Icon in H1 title
- Last updated date
- Author/maintainer listed
- Table of contents (if > 3 sections)
- Visual elements (tables, diagrams, icons)
- Code blocks with language specified
- Related documents section
- Back-to-top and navigation links
Common Patterns¶
| Pattern | Example |
|---|---|
| Warning callout | > β οΈ **Warning**: ... |
| Tip callout | > π‘ **Tip**: ... |
| Status badge | β
Complete π§ WIP |
| Keyboard shortcut | `Ctrl + S` |
| File reference | `src/index.ts` |
| Command | `npm install` |
Mermaid Quick Reference¶
| Diagram | Opening | Use For |
|---|---|---|
| Flowchart | flowchart LR/TD | Processes |
| Sequence | sequenceDiagram | Interactions |
| Class | classDiagram | Object models |
| State | stateDiagram-v2 | State machines |
| ER | erDiagram | Database |
| Gantt | gantt | Timelines |
| Git | gitGraph | Branches |
| Mindmap | mindmap | Concepts |
π Related Documents¶
| Document | Description |
|---|---|
| copilot-instructions.md | Copilot configuration |
| CONTRIBUTING.md | Contribution guidelines |
| README.md | Project overview |