···5566## Development Commands
7788-- **Start development server**: `deno task dev <markdoc-file>` or
99- `deno run --unstable-broadcast-channel --allow-env --allow-net --allow-read --allow-write main.ts dev <markdoc-file>`
88+- **Start development server**: `deno task dev` (uses scripts/dev.ts with
99+ runtime bundling and file watching)
1010+- **Core development server**: `deno task dev:core` (direct main.ts dev command)
1111+- **Runtime development**: `deno task dev:runtime` (bundles runtime to dist/)
1012- **Build static presentation**: `deno task build <markdoc-file>` or
1113 `deno run --allow-env --allow-read --allow-write main.ts build <markdoc-file> --output <directory>`
1214···2931│ │ └── fence.ts # Code fence with Shiki/Mermaid
3032│ ├── renderer.ts # Main rendering pipeline
3133│ └── types.ts # TypeScript type definitions
3434+├── runtime/ # Client-side runtime components
3535+│ ├── components/ # Lit-based web components
3636+│ │ ├── presentation.ts # Presentation component
3737+│ │ └── slide.ts # Slide component
3838+│ └── morkdeck.ts # Runtime entry point
3939+├── scripts/ # Development scripts
4040+│ └── dev.ts # Enhanced dev command with esbuild
3241├── server/ # Development server implementation
3342│ └── dev.ts # Live-reload server logic
3443├── templates/ # Eta templates
3544│ ├── presentation.eta # Main template
4545+│ ├── components/ # Component templates
4646+│ │ ├── presentation.eta # Inline Lit presentation component
4747+│ │ └── slide.eta # Inline Lit slide component
3648│ └── partials/ # Template partials
3749│ ├── live-reload.eta # Live-reload scripts
3850│ ├── mermaid.eta # Mermaid initialization
3951│ └── slide-styles.eta # CSS styles
5252+├── dist/ # Built runtime assets
4053└── main.ts # Entry point
4154```
4255···4659 - `cli/dev.ts`: Dev command that delegates to server implementation
4760 - `cli/build.ts`: Build command for static HTML generation
48614949-2. **Server Layer** (`server/`): Development server functionality
6262+2. **Runtime Layer** (`runtime/`): Client-side web components using Lit
6363+ - `runtime/components/presentation.ts`: Presentation container with
6464+ scroll-snap and URL sync
6565+ - `runtime/components/slide.ts`: Individual slide component
6666+ - `runtime/morkdeck.ts`: Custom element registration entry point
6767+ - Built to `dist/morkdeck.js` via esbuild
6868+6969+3. **Scripts Layer** (`scripts/`): Enhanced development tooling
7070+ - `scripts/dev.ts`: Orchestrates both runtime bundling and core server with
7171+ file watching
7272+ - Watches runtime files and rebuilds with esbuild
7373+ - Watches core files and restarts development server
7474+7575+4. **Server Layer** (`server/`): Development server functionality
5076 - `server/dev.ts`: Live-reload server, file watching, WebSocket handling
5177 - Serves presentations at port 8000
5278 - Uses consolidated template system
53795454-3. **Core Rendering** (`core/`): Markdoc processing and rendering
5555- - `core/renderer.ts`: Unified rendering pipeline with `renderPresentationHtml()`
8080+5. **Core Rendering** (`core/`): Markdoc processing and rendering
8181+ - `core/renderer.ts`: Unified rendering pipeline with
8282+ `renderPresentationHtml()`
5683 - `core/markdoc-config.ts`: Markdoc configuration with includes tracking
5757- - `core/nodes/fence.ts`: Code fence node with Shiki syntax highlighting and Mermaid support
8484+ - `core/nodes/fence.ts`: Code fence node with Shiki syntax highlighting and
8585+ Mermaid support
5886 - `core/types.ts`: Type definitions for render options and includes
59876088### Key Dependencies
···6492- **@markdoc/markdoc**: Markdoc parsing and rendering
6593- **shiki**: Syntax highlighting for code blocks
6694- **hast-util-is-element**: HAST tree utilities for Shiki integration
9595+- **lit**: Web component library for runtime components
9696+- **esbuild**: Runtime bundling and TypeScript compilation
9797+- **@deno/esbuild-plugin**: Deno module resolution for esbuild
67986899### Template System
691007070-**Consolidated Template Architecture:**
101101+**Hybrid Template Architecture:**
102102+71103- **`templates/presentation.eta`**: Main template for both dev and static builds
104104+- **`templates/components/`**: Inline Lit component templates
105105+ - `presentation.eta`: Inline Lit Presentation component with
106106+ IntersectionObserver
107107+ - `slide.eta`: Inline Lit Slide component
72108- **`templates/partials/`**: Modular template components
109109+ - `importmap.eta`: Import map for Lit CDN dependencies
73110 - `live-reload.eta`: WebSocket live-reload functionality (dev only)
74111 - `mermaid.eta`: Mermaid diagram initialization scripts
75112 - `slide-styles.eta`: CSS styling for presentations
7611377114**Template Features:**
115115+78116- **Includes System**: Dynamic script/style injection based on content needs
79117- **Mode Detection**: Automatic dev vs static build differentiation
80118- **Partial Composition**: Modular template components for maintainability
···8312184122- Each Markdoc file represents a complete presentation
85123- Slides are separated by `---` (horizontal rules)
8686-- The rendering process wraps each slide section in semantic HTML with custom tags:
8787- - `slide` tag → `<section>` element
8888- - `content` tag → `<div>` element
8989-- CSS uses container queries and scroll-snap for responsive slide navigation
124124+- The rendering process wraps each slide section in semantic HTML with custom
125125+ web components:
126126+ - `morkdeck-presentation` → Lit-based presentation container
127127+ - `morkdeck-slide` → Lit-based individual slide wrapper
128128+- Presentation component handles scroll-snap navigation and URL synchronization
129129+- IntersectionObserver tracks visible slides and updates browser URL hash
9013091131### Code Highlighting Features
9213293133- **Shiki Integration**: Rose Pine theme syntax highlighting for code blocks
9494-- **Mermaid Support**: Automatic detection and script injection for Mermaid diagrams
134134+- **Mermaid Support**: Automatic detection and script injection for Mermaid
135135+ diagrams
95136- **Language Detection**: Automatic language detection from fence attributes
96137- **HAST Processing**: Converts Shiki HAST output to Markdoc render nodes
9713898139### Build System
99140100141**Development Mode (`deno task dev`):**
142142+143143+- Enhanced development workflow via `scripts/dev.ts`
144144+- Runtime bundling with esbuild watching `runtime/` directory
145145+- Core server restart when `core/`, `server/`, or `cli/` files change
101146- Live-reload server at port 8000
102102-- File watching with automatic rebuild
103147- WebSocket-based browser refresh
104148- No cache headers for development
105149150150+**Core Development Mode (`deno task dev:core`):**
151151+152152+- Direct main.ts dev command execution
153153+- Basic file watching without runtime bundling
154154+155155+**Runtime Development (`deno task dev:runtime`):**
156156+157157+- Standalone runtime bundling to `dist/morkdeck.js`
158158+106159**Static Build (`deno task build`):**
107107-- Single HTML file output
160160+161161+- Single HTML file output with embedded runtime
108162- No live-reload dependencies
109163- Optimized for deployment
110164- Custom output directory support
···112166### Styling Approach
113167114168The presentation uses a dark theme with centered layout:
115115-- Full viewport slides with scroll-snap navigation
169169+170170+- Full viewport slides with scroll-snap navigation via Lit component CSS
116171- Container queries for responsive typography
117172- Recursive font family with variable font features and monospace code support
118118-- Rose Pine color scheme (`#191724` background, `#e0def4` headings, `#908caa` text)
173173+- Rose Pine color scheme (`#191724` background, `#e0def4` headings, `#908caa`
174174+ text)
175175+- Shadow DOM styling in Lit components with :host selectors
119176120177### Extending the System
121178122179**Adding Custom Markdoc Nodes:**
180180+1231811. Create a new file in `core/nodes/`
1241822. Export a function that returns a Markdoc node configuration
1251833. Import and add to the `nodes` object in `core/markdoc-config.ts`
126184185185+**Adding Runtime Components:**
186186+187187+1. Create new Lit components in `runtime/components/`
188188+2. Register custom elements in `runtime/morkdeck.ts`
189189+3. Add corresponding template components in `templates/components/` if needed
190190+127191**Adding Template Partials:**
192192+1281931. Create new `.eta` files in `templates/partials/`
1291942. Use includes system to conditionally load based on content needs
1301953. Update `core/markdoc-config.ts` to track new includes
196196+197197+### Development Workflow
198198+199199+**Primary Development Command**: Use `deno task dev` for the full development
200200+experience with:
201201+202202+- Automatic runtime bundling and rebuilding
203203+- Core server restart on backend changes
204204+- Live browser reload
205205+- Port 8000 presentation serving