A zero-dependency, client-side editable slide deck with native Mermaid diagram support. Built with vanilla JavaScript, HTML5, and CSS3. Content is persisted via localStorage and can be exported as JSON.
index.html: Slide structure withdata-content-keyanddata-diagram-keyattributes for content bindingcontent.js: Default content schema (DEFAULT_DECK_CONTENT) exported as a global constantscript.js: State management, localStorage persistence, and edit mode orchestrationstyles.css: Slide navigation, edit mode styling, and Mermaid container layouts
Content is bound to DOM elements via data-content-key attributes using dot-notation paths (e.g., slide1.title1, slide3.screen1.header). The rendering engine uses getNestedValue() and setNestedValue() helpers to traverse the content object tree.
// Example binding
<div data-content-key="slide1.title1">MCPDirect Studio</div>Mermaid diagrams are stored as raw Mermaid syntax strings in the content object under diagram keys. On render, the Mermaid library is invoked with mermaid.run({ nodes }) for selective re-rendering of modified diagrams only.
// Diagram binding
<div class="diagram-container" data-diagram-key="slide2.diagram"></div>Toggle edit mode via the floating button in the top-right corner. When enabled:
- All elements with
data-content-keybecomecontentEditable="true" - Input events trigger automatic
localStoragepersistence viasaveContent() - Mermaid diagram containers become clickable (dashed border indicator)
- Clicking a diagram opens a modal editor with syntax highlighting
Content is automatically saved to localStorage under the key mcp_deck_content:
- Deep merge strategy: Saved edits are merged with default content using
deepMerge()to preserve new keys added to defaults - Automatic save: Triggered on every
inputevent in edit mode - Load on init: On page load, saved content is merged with defaults before rendering
// Storage key
localStorage.setItem("mcp_deck_content", JSON.stringify(currentContent));The "Copy Edited Content JSON" button serializes the current content state (including unsaved edits) to a formatted JSON string and copies it to the clipboard via the Clipboard API fallback (document.execCommand('copy')).
- Scroll snap: CSS
scroll-snap-type: y mandatoryenforces full-screen slide transitions - Navigation dots: Fixed-position dots on the right side indicate current slide
- Intersection Observer: Tracks visible slides and updates active dot state
This project is designed for static hosting on GitHub Pages:
- Push to a
gh-pagesbranch, or - Configure GitHub Pages to serve from
/docsdirectory, or - Use GitHub Actions to build and deploy
No build step required—serve index.html directly.
To ensure users see the latest version after deployments, cache-busting is implemented in multiple ways:
- Query parameters on local assets (
styles.css,content.js,script.js) - Version comment and meta tag in the HTML file itself (forces HTML refresh)
- Cache-control meta tags to prevent aggressive browser caching
To update the version after making changes:
-
Automatic version bump (recommended):
./bump-version.sh
This auto-increments the patch version (e.g.,
1.0.0→1.0.1) and updates:- All asset URL query parameters
- HTML version comment
- HTML version meta tag
-
Manual version bump:
./bump-version.sh 1.1.0
-
Commit and push:
git add index.html git commit -m "Bump version for cache-busting" git push
If updates still don't appear after deployment:
- Wait 1-2 minutes for GitHub Pages to rebuild (check Actions tab)
- Hard refresh your browser:
- Chrome/Edge:
Ctrl+Shift+R(Windows) orCmd+Shift+R(Mac) - Firefox:
Ctrl+F5(Windows) orCmd+Shift+R(Mac) - Safari:
Cmd+Option+R(Mac)
- Chrome/Edge:
- Clear browser cache for your GitHub Pages domain
- Check the version displayed on slide 1 to confirm you're seeing the latest
Note: The CDN resources (Tailwind, Mermaid, Google Fonts) are versioned separately and don't need cache-busting. The HTML file itself is now also versioned to force refresh.
- Tailwind CSS:
https://cdn.tailwindcss.com - Mermaid.js:
https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.0/mermaid.min.js - Google Fonts: Inter font family
The content object follows a nested structure:
{
slide1: {
badge: "string",
title1: "string",
title2: "string",
description: "string",
// ... nested objects
},
slide2: {
header: "string",
description: "string",
diagram: "graph LR\n A --> B" // Mermaid syntax
}
}- Add a new
<section id="slide-N">inindex.html - Add corresponding content object in
content.jsunderDEFAULT_DECK_CONTENT - Bind elements with
data-content-key="slideN.property"
Mermaid is initialized with:
mermaid.initialize({
startOnLoad: false,
theme: "dark",
securityLevel: "loose",
fontFamily: "Inter",
flowchart: { useMaxWidth: true, htmlLabels: true },
});- Multiple slide deck support: Store and switch between multiple deck instances in localStorage with a deck selector UI
- GitHub integration: Submit edited content as a pull request via GitHub API after edits are saved
- Export formats: PDF export via browser print API, Markdown export for documentation
- Collaborative editing: Real-time sync via WebSockets or GitHub API webhooks
- Version history: Track edit history with timestamps and diff visualization
- Template system: Pre-built slide templates for common presentation types
- Keyboard shortcuts: Navigate slides with arrow keys, toggle edit mode with
E - Undo/redo: Implement command pattern for content edit history
- Module system: Convert to ES6 modules for better code organization
- Type safety: Add JSDoc type annotations or migrate to TypeScript
- Testing: Unit tests for content merging, localStorage operations, and Mermaid rendering
- Performance: Virtualize slide rendering for decks with 50+ slides
- Accessibility: ARIA labels, keyboard navigation, screen reader support
MIT