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 ๐ค๐ค
- Host: GitHub
- URL: https://github.com/utkarsh5026/mdhd
- Owner: utkarsh5026
- Created: 2025-06-14T13:48:55.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-28T00:45:24.000Z (12 months ago)
- Last Synced: 2025-07-04T22:40:24.736Z (11 months ago)
- Topics: frontend, markdown, nodejs, react, shadcn-ui, tailwindcss, tyoescript
- Language: TypeScript
- Homepage: https://mdhd.vercel.app
- Size: 783 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# MDHD
**Turn walls of markdown into focused, distraction-free reading sessions.**
[](https://github.com/utkarsh5026/mdhd/actions)
[](LICENSE)
[](https://react.dev)
[](https://www.typescriptlang.org)
[](https://vite.dev)
[](https://mdhd.vercel.app)
[](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**
[](https://github.com/utkarsh5026)
[](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.