Pika πΎ
A lightning-fast local document viewer for Markdown, HTML, and more - peek at your files like a pika!
β¨ Features
- π Markdown Viewer - Beautiful GitHub-style rendering with zenn-markdown-html
- βοΈ In-Browser Editing - Edit Markdown files directly in your browser with keyboard shortcuts
- π’ Announcement System - Automatic notifications for updates and important messages
- π HTML Support - Display HTML files with smart iframe embedding
- πΌοΈ HTML Code Preview - Interactive preview for HTML code blocks with source toggle
- π Mermaid Diagrams - Direct rendering without iframes
- π¨ Marp Presentations - Full support for slide presentations
- π Smart Directory Browser - Recursive browsing with collapsible tree view
- π Flexible Filtering - Exclude patterns with regex support
- π¬ Chat Format - Special rendering for conversation-style content
- πΌοΈ Image Support - Automatic path resolution for local images
- β‘ Lightning Fast - Local server for instant file viewing
- π― Zero Config - Works out of the box with sensible defaults
π Quick Start
Using npx (Recommended - No Installation Required!)
# View current directory
npx @koinunopochi/pika
# View specific directory
npx @koinunopochi/pika /path/to/docs
# View recursively
npx @koinunopochi/pika . -r
Global Installation
npm install -g @koinunopochi/pika
pika [directory] [options]
π Usage
Basic Commands
Note: The commands below assume you have either:
- Installed globally:
npm install -g @koinunopochi/pika- Or are using npx:
npx @koinunopochi/pika(recommended)- Or running from project directory:
npm start(requires--before arguments)
# View current directory (non-recursive)
pika
npx @koinunopochi/pika
npm start
# View specific directory
pika /path/to/directory
npx @koinunopochi/pika /path/to/directory
npm start -- /path/to/directory # Note: -- is required for npm start
# Recursive mode - view all subdirectories
pika . -r
npx @koinunopochi/pika . -r
npm start -- . -r # Note: -- is required for npm start
# With custom exclude patterns
pika . -r -e "test.*,__tests__"
npx @koinunopochi/pika . -r -e "test.*,__tests__"
npm start -- . -r -e "test.*,__tests__" # Note: -- is required for npm start
Common Use Cases
# π View project documentation
npx @koinunopochi/pika ./docs -r
# π¬ View source code documentation (excluding tests)
npx @koinunopochi/pika ./src -r -e "test,spec,__test__"
# π View all Markdown files in a project
npx @koinunopochi/pika . -r
# π¨ View presentation slides
npx @koinunopochi/pika ./slides -r
# π View blog posts or articles
npx @koinunopochi/pika ./content/posts -r
π― Command Line Options
| Option | Alias | Description | Default |
|---|---|---|---|
[directory] |
- | Target directory to view | Current directory (.) |
--recursive |
-r |
Include subdirectories | false |
--exclude |
-e |
Comma-separated regex patterns to exclude | See default exclusions |
--help |
-h |
Show help message | - |
--version |
-v |
Show version number | - |
Default Exclusions
These directories are always excluded to improve performance:
node_modules.git.nextdistbuildcoverage.cache.vscode.idea
π Features in Detail
π Markdown Rendering
- GitHub-Flavored Markdown - Full GFM support
- Syntax Highlighting - Beautiful code blocks with language detection
- HTML Code Preview - Interactive HTML rendering with source toggle
- Task Lists - Interactive checkboxes
- Tables - Responsive table rendering
- Footnotes - Elegant footnote support
- Emoji - Full emoji support π
- Details/Summary - Collapsible content sections
βοΈ In-Browser Editing (New!)
Edit your Markdown files directly in the browser:
How to use:
- Select any text in a Markdown file
- Press
Ctrl+E(Windows/Linux) orβ+E(Mac) - Edit the text in the popup dialog
- Press
Ctrl+Enterorβ+Enterto save - Page automatically reloads with your changes
Features:
- Keyboard Shortcuts - Quick editing with hotkeys
- Visual Feedback - Tooltip shows shortcut when text is selected
- Auto-save - Changes are saved directly to the file
- Smart Detection - Only works on Markdown content
- Safe Editing - Original text is preserved until you save
π’ Announcement System (New!)
Stay updated with automatic notifications:
Features:
- Auto-fetch - Checks for announcements on startup and every hour
- Priority Levels - Info (βΉοΈ), Warning (β οΈ), Error (β)
- Dismiss Management - Close notifications to mark as read
- Persistent Storage - Uses localStorage to remember dismissed items
- Non-intrusive - Slides in from the right, errors auto-dismiss after 5 seconds
- Badge Counter - Shows unread count in a pulsing red badge
- Expandable Details - Click notifications to see full content and links
Notification UI:
- Appears in the top-right corner
- Click header to expand/collapse details
- Click Γ to dismiss and mark as read
- Click the badge to show all notifications again
πΌοΈ HTML Code Block Preview
Transform HTML code blocks into interactive previews:
```html
<h1>Hello World!</h1>
<p>This renders as actual HTML!</p>
<button onclick="alert('Interactive!')">Click Me</button>
```
```html:index.html
<!DOCTYPE html>
<html>
<head><title>My Page</title></head>
<body>
<h1>Title support too!</h1>
</body>
</html>
```
Features:
- Live Preview - See HTML rendered in real-time
- Source Toggle - Switch between preview and code view
- Title Support - Works with
html:filenamesyntax - Interactive Elements - Buttons, forms, and scripts work
- Sandbox Security - Safe iframe execution
π Mermaid Diagrams
graph TD
A[Start] --> B{Is it working?}
B -->|Yes| C[Great!]
B -->|No| D[Check the docs]
- Flowcharts, sequence diagrams, Gantt charts, and more
- Auto-sizing and responsive design
- No iframe overhead
π¦ Collapsible Content (Details/Summary)
Use native HTML details tags for collapsible sections:
<details>
<summary>Click to expand</summary>
Hidden content here!
- Supports lists
- Code blocks
- Any markdown content
</details>
Features:
- Native Browser Support - Works without JavaScript
- Smooth Animations - CSS transitions for expand/collapse
- Nested Support - Details within details
- Styled Design - Beautiful GitHub-like appearance
π¨ Marp Presentations
---
marp: true
theme: default
---
# Your Presentation
Slides with style!
- Auto-detection of Marp documents
- Keyboard navigation (β β)
- Slide counter
- Full-screen optimized
π HTML File Support
- Smart iframe embedding
- Collapsible UI to save space
- Preserves relative links and assets
- Sandbox security
π Directory Browser
- Tree View - Intuitive file organization
- Collapsible Folders - Click to expand/collapse
- File Counts - See how many files in each folder
- State Persistence - Remembers your expanded folders
- Smart Icons - π for Markdown, π for HTML
π¬ Chat Format Support
Transform specially formatted content into beautiful chat UIs:
<!-- CHAT-CONVERSION-START: discussion-1 -->
[CHAT-DATA-BEGIN]
π€ User 10:30
How does this work?
[emotion: curious]
[tags: question,feature]
---
π©βπ« Support 10:32
It automatically converts your formatted text into a chat interface!
[emotion: helpful]
[tags: answer,demo]
[CHAT-DATA-END]
<!-- CHAT-CONVERSION-END -->
βοΈ Configuration
Port Configuration
Default port: 15559
To use a different port:
PORT=3000 pika .
Advanced Exclude Patterns
Exclude patterns use JavaScript regex:
# Exclude test files
pika . -r -e "\.test\.|\.spec\.|__tests__"
# Exclude multiple patterns
pika . -r -e "\.test\.,\.tmp\.,\.cache"
# Exclude by file extension
pika . -r -e "\.log$|\.tmp$"
ποΈ Architecture
Pika is built with:
- TypeScript - Type-safe codebase
- Express.js - Fast, minimal web server
- Clean Architecture - Maintainable and testable design
- TDD - Test-driven development with >85% coverage
src/
βββ domain/ # Business entities and interfaces
βββ application/ # Use cases and services
βββ infrastructure/# Technical implementations
βββ presentation/ # Web UI and controllers
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
π Troubleshooting
Common Issues
Port already in use
# Kill the process using port 15559
lsof -ti:15559 | xargs kill -9
Permission denied
# Make sure the file is executable
chmod +x ./dist/server.js
Images not loading
- Ensure image paths are relative to the Markdown file
- Check that image files exist in the specified location
π License
MIT Β© koinunopochi
Made with β€οΈ by developers, for developers