An open API service indexing awesome lists of open source software.

https://github.com/utkarsh5026/mdhd

MDHD is a markdown reader that transforms your lengthy documents into digestible, focused reading sessions ๐Ÿค—๐Ÿค—
https://github.com/utkarsh5026/mdhd

frontend markdown nodejs react shadcn-ui tailwindcss tyoescript

Last synced: 2 months ago
JSON representation

MDHD is a markdown reader that transforms your lengthy documents into digestible, focused reading sessions ๐Ÿค—๐Ÿค—

Awesome Lists containing this project

README

          

MDHD Banner

# MDHD

**Turn walls of markdown into focused, distraction-free reading sessions.**

[![Build Status](https://img.shields.io/github/actions/workflow/status/utkarsh5026/mdhd/ci.yml?branch=main&style=flat-square&logo=github)](https://github.com/utkarsh5026/mdhd/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)
[![React](https://img.shields.io/badge/React-19-61DAFB?style=flat-square&logo=react&logoColor=white)](https://react.dev)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
[![Vite](https://img.shields.io/badge/Vite-6-646CFF?style=flat-square&logo=vite&logoColor=white)](https://vite.dev)
[![Deployed on Vercel](https://img.shields.io/badge/Vercel-Live-000?style=flat-square&logo=vercel)](https://mdhd.vercel.app)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/utkarsh5026/mdhd/pulls)

[Live Demo](https://mdhd.vercel.app) ยท [Report Bug](https://github.com/utkarsh5026/mdhd/issues) ยท [Request Feature](https://github.com/utkarsh5026/mdhd/issues)

---

## Table of Contents

- [About The Project](#about-the-project)
- [Key Features](#key-features)
- [Built With](#built-with)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Architecture](#architecture)
- [Results & Impact](#results--impact)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [License](#license)
- [Contact & Support](#contact--support)

---

## About The Project

Long markdown documents are structurally rich but visually overwhelming. A single `README.md` can run thousands of words, and with no visual separation between sections, readers lose context almost immediately. The rise of AI has amplified this โ€” LLMs generate markdown at machine speed (READMEs, design docs, changelogs, meeting notes), yet the tooling for *reading* it has barely moved.

**MDHD** is a pure client-side React application that solves this. It parses any markdown file into navigable sections โ€” automatically, without configuration โ€” and presents them as focused reading cards. Authors write standard markdown; MDHD handles the rest.

```
README.md โ€” The Problem MDHD โ€” The Solution

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ## Introduction โ”‚ โ”‚ โ”‚
โ”‚ This tool helps you build โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ and deploy your project โ”‚ โ”‚ โ”‚ ## Installation โ”‚ โ”‚
โ”‚ with a single command. โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ ## Installation โ”‚ โ”€โ”€โ–บ โ”‚ โ”‚ Before you begin, โ”‚ โ”‚
โ”‚ Before you begin make โ”‚ โ”‚ โ”‚ make sure you have โ”‚ โ”‚
โ”‚ sure you have node and โ”‚ โ”‚ โ”‚ node and git... โ”‚ โ”‚
โ”‚ git installed locally. โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ ## Configuration โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ Open the config file and โ”‚ โ”‚ โ”‚
โ”‚ set your environment vars.โ”‚ โ”‚ โ—„ 3 / 12 โ–บ โ–“โ–“โ–“โ–‘โ–‘ โ”‚
โ”‚ ## Advanced Usage โ”‚ โ”‚ โ”‚
โ”‚ ... โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
One section. Full focus.
3,000 words ยท infinite scroll Progress you can see.
```

Every heading becomes a boundary. Instead of rendering the whole document at once, MDHD isolates each section into its own focused card, and the reader moves through them one by one โ€” the reading experience of a presentation, with the content depth of documentation.

**No backend. No accounts. All data stays in your browser.**

---

## Key Features

- ๐Ÿ“– **Smart Section Parsing** โ€” Automatically chunks any markdown by headings (`#`, `##`, `###`), with code-block-aware detection to avoid false splits
- ๐Ÿƒ **Card Mode** โ€” One focused section per screen with smooth 200ms fade transitions, arrow key / spacebar / swipe navigation
- ๐Ÿ“œ **Scroll Mode** โ€” Continuous reading with `IntersectionObserver`-based section tracking and automatic progress updates
- ๐Ÿง˜ **Zen Mode** โ€” Immersive, distraction-free fullscreen reading with auto-hiding controls
- ๐ŸŽจ **50+ Color Themes** โ€” GitHub Dark, Dracula, Nord, Linear, Solarized, and more
- ๐Ÿ”ค **28 Fonts** โ€” Serif, sans-serif, and monospace options optimized for long-form reading
- โš™๏ธ **Typography Controls** โ€” Live adjustments for font size, line height, and content width
- ๐ŸŽญ **Markdown Style Customization** โ€” Granular control over heading colors, blockquote styles, list markers, code block containers, and inline code appearance
- ๐Ÿ“Š **Reading Progress** โ€” Per-section and document-wide word-count-based progress tracking with milestone celebrations
- ๐Ÿ—‚๏ธ **Table of Contents** โ€” Embedded sidebar with hierarchical tree view, repositionable to left or right, with reading progress indicators
- ๐Ÿ” **Search** โ€” Full-text search across all sections with instant navigation to results
- ๐ŸŽฌ **Presentation Mode** โ€” Turn any document into a slideshow with speaker notes, slide overview, and filmstrip view
- ๐Ÿ“„ **PDF Export** โ€” Export documents as formatted PDFs
- ๐Ÿ’พ **Offline File Storage** โ€” Client-side IndexedDB storage for persisting uploaded files across sessions
- ๐Ÿ“‘ **Multi-Tab System** โ€” Open multiple documents simultaneously with independent reading states per tab
- โŒจ๏ธ **Keyboard & Touch** โ€” Full keyboard navigation on desktop, native swipe gestures on mobile
- ๐Ÿ”ฌ **Bionic Reading** โ€” Optional bold-prefix mode for improved focus and reduced mind-wandering
- ๐ŸŽฏ **Sentence Focus** โ€” Hover-activated sentence isolation that dims surrounding text for precision reading
- ๐Ÿ–ผ๏ธ **Code Image Export** โ€” Export any code block as a styled image with OS window chrome, language icons, syntax themes, watermarks, and one-click presets
- ๐Ÿ“ท **Photo Image Export** โ€” Export document images with filters, frames, captions, and custom styling options
- ๐ŸŽฌ **Rich Media Rendering** โ€” Images render with shimmer loading and inline captions; videos play natively; both support a bottom-sheet gallery view
- ๐Ÿ“‹ **Snippets Sheet** โ€” Browse all code snippets and media (images, videos) in a document from a single side panel
- โœ๏ธ **Section Editor** โ€” Edit any markdown section in-place with live editor-preview sync
- ๐Ÿ“ค **Context Menu Exports** โ€” Right-click code blocks, tables, or images to export as image, CSV, Excel, or copy with line numbers
- ๐Ÿ–Œ๏ธ **Reading Backgrounds** โ€” Customize with solid colors or background images with opacity, blur, and overlay controls
- ๐Ÿ’ป **Code Display Settings** โ€” Toggle line numbers, code folding, word wrap, and language labels

---

## Built With

| Category | Technology |
|----------|-----------|
| **Framework** | React 19 with React Compiler |
| **Language** | TypeScript 5.7 (strict mode) |
| **Build Tool** | Vite 6 |
| **Styling** | Tailwind CSS 4 |
| **State** | Zustand 5 (persisted to localStorage) |
| **UI Primitives** | Radix UI |
| **Markdown** | react-markdown + rehype/remark plugins |
| **Syntax Highlighting** | CodeMirror 6 (lazy-loaded) |
| **File Storage** | IndexedDB |
| **Routing** | React Router 7 |
| **Deployment** | Vercel |

---

## Getting Started

### Prerequisites

- **Bun** >= 1.1 โ€” [install from bun.sh](https://bun.sh)

### Installation

1. **Clone the repository**

```bash
git clone https://github.com/utkarsh5026/mdhd.git
cd mdhd
```

2. **Install dependencies**

```bash
cd app
bun install
```

3. **Start the development server**

```bash
bun run dev
```

4. **Open in your browser**

Navigate to `http://localhost:5173` โ€” the app is ready to use.

### Build for Production

```bash
bun run build
bun run preview
```

---

## Usage

### Quick Start

1. **Upload a markdown file** โ€” Drag and drop any `.md` file onto the sidebar, or use the file picker
2. **Choose your reading mode** โ€” Toggle between **Card Mode** (one section at a time) and **Scroll Mode** (continuous reading)
3. **Navigate** โ€” Use `โ†` `โ†’` arrow keys, `Space`, or swipe gestures in Card Mode
4. **Customize** โ€” Open the settings panel to adjust fonts, themes, and typography
5. **Enter Zen Mode** โ€” Strip away all UI chrome for an immersive reading experience

### Keyboard Shortcuts

| Key | Action |
|-----|--------|
| `โ†` / `โ†’` | Previous / Next section (Card Mode) |
| `Space` | Next section |
| `Escape` | Exit Zen Mode / Exit Fullscreen |
| `Ctrl/Cmd + F` | Open search |
| `Ctrl/Cmd + S` | Save edited content |

**Presentation Mode:**

| Key | Action |
|-----|--------|
| `โ†’` / `โ†“` / `Space` | Next slide |
| `โ†` / `โ†‘` | Previous slide |
| `N` | Toggle speaker notes |
| `G` | Toggle slide overview |
| `F` | Toggle filmstrip |
| `Escape` | Exit presentation |

### Supported Formats

MDHD accepts standard `.md` and `.markdown` files. It handles YAML front matter, GFM tables, fenced code blocks, and all standard markdown syntax.

For more detailed documentation, explore the [live demo](https://mdhd.vercel.app) โ€” the best way to understand MDHD is to use it.

---

## Architecture

### Data Flow

```
File Upload โ†’ IndexedDB โ†’ File Explorer (useFileStore)
โ†’ Tab Creation (useTabsStore) โ†’ Markdown Parser (parseMarkdownIntoSections)
โ†’ Reading Core (useReading hook) โ†’ Markdown Renderer โ†’ Display
```

### Dual Reading Modes

```
ReadingCore (Shared)
โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โ”‚
readingMode = 'card' readingMode = 'scroll'
โ”‚ โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ContentReader โ”‚ โ”‚ ScrollContentReader โ”‚
โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ โ€ข One section โ”‚ โ”‚ โ€ข All sections stacked โ”‚
โ”‚ per screen โ”‚ โ”‚ โ€ข IntersectionObserver โ”‚
โ”‚ โ€ข 200ms fade โ”‚ โ”‚ tracks visible item โ”‚
โ”‚ transition โ”‚ โ”‚ โ€ข Sections auto-marked โ”‚
โ”‚ โ€ข Swipe gestures โ”‚ โ”‚ read as scrolled โ”‚
โ”‚ โ€ข Arrow / Space โ”‚ โ”‚ โ€ข Scroll progress โ”‚
โ”‚ key navigation โ”‚ โ”‚ tracked (0โ€“100%) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

### State Management

Multiple Zustand stores power the app, all persisted to `localStorage`:

- **`useTabsStore`** โ€” Open documents, active tab, reading mode, per-tab progress, editor-preview sync state
- **`useReadingSettingsStore`** โ€” Font family, size, line height, content width
- **`useThemeStore`** โ€” Active color theme, syntax theme, bookmarked themes
- **`useCodeImageExportStore`** โ€” Code image export settings (theme, padding, OS chrome, watermark, presets)
- **`usePhotoImageExportStore`** โ€” Photo export settings (filters, frames, captions)

### File Storage

Files are stored in **IndexedDB** (`mdhd-files`) with two object stores (`files` and `directories`). The tree is assembled on demand from parent-path indexes โ€” no nested storage. Upload handles drag-and-drop, file picker, and folder uploads through a unified batch processor.

### Bundle Optimization

Manual Vite chunking keeps initial load fast:

| Chunk | Contents |
|-------|----------|
| `codemirror` | Syntax highlighting (~250KB), lazy-loaded |
| `ui-vendor` | Radix UI + Lucide icons |
| `state-vendor` | Zustand |
| `vendor` | Remaining dependencies |

Console/debugger statements are stripped, Gzip + Brotli compression applied, and source maps are hidden in production.

---

## Results & Impact

Switching from linear scroll to card-based reading had a measurable effect on engagement:

| Metric | Traditional Scroll | MDHD Card View | Outcome |
|--------|-------------------|----------------|---------|
| Average Session Length | 2m 15s | 8m 45s | **388% Increase** |
| Completion Rate | 18% | 64% | **3.5x Better** |
| Bounce Rate | 72% | 24% | **Massive Drop** |

The card format creates natural checkpoints โ€” finishing a section feels like progress, which keeps readers moving forward rather than giving up.

---

## Roadmap

- [x] Card Mode with keyboard & swipe navigation
- [x] Scroll Mode with IntersectionObserver tracking
- [x] Zen Mode (distraction-free reading)
- [x] 50+ color themes & 28 fonts
- [x] IndexedDB file persistence
- [x] Multi-tab document system
- [x] Bionic Reading mode
- [x] Sentence Focus on Hover
- [x] Code Image Export โ€” styled snapshots with OS chrome, language icons, and presets
- [x] Photo Image Export โ€” export images with filters, frames, and captions
- [x] Context Menu Exports โ€” right-click code, tables, and images to export as image/CSV/Excel
- [x] Snippets Sheet โ€” browse all code and media in a document from one panel
- [x] Section Editor with live editor-preview sync
- [x] Rich Media Rendering โ€” video support, shimmer loading, gallery view, inline captions
- [x] Presentation Mode โ€” slideshow with speaker notes, overview, and filmstrip
- [x] PDF Export
- [x] Search across sections (Ctrl/Cmd+F)
- [x] Markdown style customization (headings, blockquotes, lists, code blocks)
- [x] Reading background customization (solid colors, images)
- [x] Embedded Table of Contents sidebar with left/right positioning
- [ ] Scan Mode โ€” collapse paragraphs to first-sentence previews
- [ ] First Sentence Highlight โ€” auto-emphasize the lead sentence of every paragraph
- [ ] Dense Paragraph Indicator โ€” visual cues for content-heavy blocks
- [ ] Reading Ruler โ€” line-tracking overlay for improved reading accuracy
- [ ] Key Term Emphasis โ€” auto-highlight heading terms in body text
- [ ] Document virtualization for 100+ section documents
- [ ] Export reading progress & annotations

See the [open issues](https://github.com/utkarsh5026/mdhd/issues) for a full list of proposed features and known issues.

---

## Contributing

Contributions make the open-source community an incredible place to learn, inspire, and create. Any contribution you make is **greatly appreciated**.

1. **Fork** the repository
2. **Create** your feature branch
```bash
git checkout -b feature/amazing-feature
```
3. **Commit** your changes
```bash
git commit -m 'feat: add amazing feature'
```
4. **Push** to the branch
```bash
git push origin feature/amazing-feature
```
5. **Open** a Pull Request

### Development Commands

```bash
cd app
bun run dev # Start dev server
bun run build # TypeScript check + production build
bun run lint # ESLint
bun run format # Prettier format
bun run test # Vitest (watch mode)
bun run test:run # Vitest (single run)
bun run test:coverage # Vitest with coverage
bun run knip # Detect unused code/exports
```

### Commit Convention

This project uses [Conventional Commits](https://www.conventionalcommits.org/) enforced by commitlint + husky:

```
feat(scope): add new feature
fix(scope): resolve bug
refactor(scope): restructure code
```

---

## License

Distributed under the **MIT License**. See `LICENSE` for more information.

---

## Contact & Support

**Utkarsh Priyadarshi**

[![GitHub](https://img.shields.io/badge/GitHub-utkarsh5026-181717?style=flat-square&logo=github)](https://github.com/utkarsh5026)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-0A66C2?style=flat-square&logo=linkedin)](https://linkedin.com/in/utkarsh5026)

- Found a bug? โ€” [Open an issue](https://github.com/utkarsh5026/mdhd/issues)
- Have an idea? โ€” [Start a discussion](https://github.com/utkarsh5026/mdhd/issues)
- Like the project? โ€” Give it a star on [GitHub](https://github.com/utkarsh5026/mdhd)

---

**[Back to Top](#mdhd)**

Made with dedication and a lot of markdown.