vibe-viewer
v0.1.2
Published
Local Markdown browser (npx) with beautiful-mermaid Mermaid rendering and live reload
Downloads
28
Readme
vibe-viewer
vibe-viewer is a local Markdown browser you can run with npx.
Key features:
- One-command launch:
npx vibe-viewer - Pick a root directory and browse all Markdown files (recursively) in your browser
- File tree on the left, preview on the right
- Rendering pipeline:
markdown-it -> HTML -> DOM post-process (asset rewriting + beautiful-mermaid) - Mermaid fenced blocks (```mermaid) are rendered to SVG via beautiful-mermaid
- Auto refresh on save/add/remove (WebSocket + chokidar)
Quick Start
Requirements: Node.js >= 18.18.
Interactive mode (choose a directory):
npx -y vibe-viewerRun with a fixed root directory:
npx -y vibe-viewer --dir /path/to/your/docsDo not open the browser automatically:
npx -y vibe-viewer --no-openCLI Options
--dir <path>: Root directory (if omitted, you'll be prompted)--theme <name>: beautiful-mermaid theme name (default:tokyo-night)--no-open: Do not open the browser automatically
UI Settings
In the sidebar footer you can configure:
securityLevelallow-all(default): allow raw HTML; no sanitization; do not blockjavascript:links (only recommended for trusted local docs)allow-html: allow raw HTML; apply basic sanitization; blockjavascript:linksstrict: setmarkdown-ittohtml=false; block high-risk protocols likejavascript:/data:
breaks: soft line breaks (similar to VS Codemarkdown.preview.breaks)emoji: enable/disablemarkdown-it-emojimath: enable/disablemarkdown-it-katex(KaTeX)
Development
npm install
npm run build
node dist/cli.js --dir ./fixtures --no-openTests
Run everything (build + render snapshots + server/WS/watcher):
npm test- Render regression:
npm run test:render- Fixtures:
fixtures/*.md,fixtures/**/*.md - Snapshots:
fixtures/__snapshots__/*.html - Coverage: securityLevel + breaks/emoji/math combinations, asset rewriting, beautiful-mermaid rendering, etc.
- Fixtures:
- Server regression:
npm run test:server- Coverage:
/api/tree,/api/file, WebSocketfile-changed/tree-changed, watching opened files outside Root, and edge cases like unix sockets under Root (e.g.~/.docker/run/docker.sock).
- Coverage:
Security Note
This project assumes "local use + trusted Markdown content" and defaults to securityLevel=allow-all.
Notes:
markdown-it-katexhas a known XSS advisory reported bynpm audit(no upstream fix at the time of writing). If you render untrusted docs, preferallow-html(sanitized) orstrict(disable raw HTML).
