···11+# CLAUDE.md
22+33+This file provides guidance to Claude Code (claude.ai/code) when working with
44+code in this repository.
55+66+## Development Commands
77+88+- **Start development server**: `deno task dev` or
99+ `deno run --unstable-broadcast-channel --allow-env --allow-net --allow-read --allow-write main.ts dev <path-to-markdoc-file>`
1010+1111+## Architecture Overview
1212+1313+**morkdeck** is a slideshow generator that converts Markdoc files into web-based
1414+presentations. The architecture follows a modular pipeline with clear separation
1515+of concerns:
1616+1717+### Directory Structure
1818+1919+```
2020+morkdeck/
2121+├── cli/ # CLI command definitions
2222+│ └── dev.ts # Dev command interface
2323+├── core/ # Core rendering logic
2424+│ ├── markdoc-config.ts # Markdoc configuration
2525+│ ├── nodes/ # Custom Markdoc nodes
2626+│ │ └── fence.ts # Code fence with Shiki/Mermaid
2727+│ └── renderer.ts # Main rendering pipeline
2828+├── server/ # Development server implementation
2929+│ └── dev.ts # Live-reload server logic
3030+├── templates/ # HTML templates
3131+│ └── live-reload.eta
3232+└── main.ts # Entry point
3333+```
3434+3535+### Core Components
3636+3737+1. **CLI Layer** (`cli/`): Command definitions using Cliffy framework
3838+ - `cli/dev.ts`: Dev command that delegates to server implementation
3939+4040+2. **Server Layer** (`server/`): Development server functionality
4141+ - `server/dev.ts`: Live-reload server, file watching, WebSocket handling
4242+ - Serves presentations at port 8000
4343+ - Uses Eta templating engine for HTML generation
4444+4545+3. **Core Rendering** (`core/`): Markdoc processing and rendering
4646+ - `core/renderer.ts`: Main rendering pipeline, slide grouping
4747+ - `core/markdoc-config.ts`: Markdoc configuration assembly
4848+ - `core/nodes/fence.ts`: Code fence node with Shiki syntax highlighting and
4949+ Mermaid support
5050+5151+### Key Dependencies
5252+5353+- **@cliffy/command**: CLI framework
5454+- **@eta-dev/eta**: Template engine for HTML generation
5555+- **@markdoc/markdoc**: Markdoc parsing and rendering
5656+- **shiki**: Syntax highlighting for code blocks
5757+- **hast-util-is-element**: HAST tree utilities for Shiki integration
5858+5959+### Presentation Structure
6060+6161+- Each Markdoc file represents a complete presentation
6262+- Slides are separated by `---` (horizontal rules)
6363+- The rendering process wraps each slide section in semantic HTML with custom
6464+ tags:
6565+ - `slide` tag → `<section>` element
6666+ - `content` tag → `<div>` element
6767+- CSS uses container queries and scroll-snap for responsive slide navigation
6868+6969+### Code Highlighting Features
7070+7171+- **Shiki Integration**: Rose Pine theme syntax highlighting for code blocks
7272+- **Mermaid Support**: Automatic detection and script injection for Mermaid
7373+ diagrams
7474+- **Language Detection**: Automatic language detection from fence attributes
7575+- **HAST Processing**: Converts Shiki HAST output to Markdoc render nodes
7676+7777+### Styling Approach
7878+7979+The presentation uses a dark theme with centered layout:
8080+8181+- Full viewport slides with scroll-snap navigation
8282+- Container queries for responsive typography
8383+- Recursive font family with variable font features and monospace code support
8484+- Rose Pine color scheme (`#191724` background, `#e0def4` headings, `#908caa`
8585+ text)
8686+8787+### Live Reload System
8888+8989+Uses Deno's BroadcastChannel API to coordinate between:
9090+9191+- File watcher that detects changes to the source Markdoc file
9292+- WebSocket connection that triggers browser reload
9393+- No external dependencies required for hot reloading
9494+9595+### Extending Nodes
9696+9797+To add new custom Markdoc nodes:
9898+9999+1. Create a new file in `core/nodes/`
100100+2. Export a function that returns a Markdoc node configuration
101101+3. Import and add to the `nodes` object in `core/markdoc-config.ts`