MarkBun
April 10, 2026 ยท View on GitHub
ไธญๆ | English
๐ A fast, beautiful, Typora-like markdown desktop editor
MarkBun is an open-source, cross-platform markdown editor designed for seamless writing. Like Typora, it provides a distraction-free WYSIWYG editing experience where markdown syntax fades away to reveal beautifully formatted content.
Mark (from Markdown) + Bun (from Electrobun) = MarkBun
๐ Why "MarkBun"?
In the Age of AI, Markdown is the lingua franca โ the universal currency of digital communication. Learn Markdown, earn your bread. It's that simple. (Plus, "Markbun" sounds way tastier than "Plaintextbun")
๐ง Development Status
โ ๏ธ Early Development Stage
MarkBun is currently in active development.
Current Status:
- โ Electrobun desktop framework configured
- โ React + Vite + Tailwind CSS setup
- โ Development environment with HMR
- โ Milkdown WYSIWYG editor integration
- โ File operations (New, Open, Save, Save As)
- โ Dark mode support
- โ Toolbar and status bar (hidden by default)
- โ File explorer sidebar (v0.2.0)
- โ Outline navigation (v0.2.0)
- โ Quick Open (Ctrl/Cmd+P)
- โ Auto-save (v0.3.0)
- โ Settings UI (v0.3.0)
- โ Multi-monitor support (v0.3.0)
- โ Three-layer file protection (v0.4.0)
- โ Export to PNG/HTML (v0.4.0)
- โ Math equations (v0.4.0)
- โ Find & Replace (v0.5.0)
- โ Command Palette (v0.5.0)
- โ Session Persistence (v0.5.0)
- โ Windows Support (v0.5.0)
- โ AI Chat Assistant (v0.6.0)
- โ Mermaid Diagrams & HTML Blocks (v0.7.0)
- โ Frontmatter Support (v0.7.0)
- โ Editor Polish & Bug Fixes (v0.8.0)
See ROADMAP.md for detailed development phases.
โจ Features
Design Philosophy
MarkBun follows a chromeless editing philosophy inspired by the pioneering work of iA Writer and Typora. The interface is intentionally minimal โ all toolbars, title bars, and status bars are hidden by default to eliminate visual distractions and keep you focused on your content.
When you need them, every UI element can be instantly toggled via the View menu or keyboard shortcuts. This approach puts the written word at the center of the experience, not the application chrome.
Core Features
- ๐ฏ Seamless WYSIWYG Editing - Write markdown naturally without distraction
- โก Lightning Fast - Built with Bun and native webviews for <50ms startup
- ๐จ Beautiful Typography - Carefully crafted themes and styles
- ๐ผ๏ธ Chromeless Interface - Distraction-free writing with all UI elements hidden by default
- ๐ Dark Mode - Easy on the eyes for night writing
- ๐ File Management - Built-in file browser with folder support
- ๐ Outline Navigation - Jump to any heading instantly
- โก Quick Open - Fuzzy file finder with Ctrl/Cmd+P
- ๐งฎ Math Support - LaTeX equations with live preview
- ๐ Tables - Intuitive table editing with header styling
- ๐พ Auto Save - Hybrid throttle/debounce strategy
- โ๏ธ Settings - Persistent settings with UI
- ๐ฅ๏ธ Multi-Monitor - Window position saved per display with smart fallback
- ๐ก๏ธ File Protection - Atomic write, crash recovery, and version history
- ๐ค Export - Export to PNG and HTML
- ๐ Find & Replace - Search with highlighting across WYSIWYG and code blocks (
Cmd/Ctrl + F) - ๐๏ธ Command Palette - Unified command palette with fuzzy search and history (
Cmd/Ctrl + P) - ๐พ Session Restore - Cursor position and scroll state saved between sessions
- ๐ช Windows Support - Native menu bar, icons, and CI for Windows
- โจ๏ธ Keyboard Shortcuts - Comprehensive shortcuts for formatting and navigation
- ๐ค Source Mode - Toggle between WYSIWYG and source code editing (
Cmd/Ctrl + /) - ๐ค AI Assistant - Multi-provider AI chat with document editing tools (OpenAI, Anthropic, Ollama, etc.)
- ๐ Mermaid Diagrams - View Mermaid diagrams with zoom and pan support
- ๐ HTML Blocks - Render HTML blocks with DOMPurify preview support
- ๐ Frontmatter - Display YAML frontmatter in the editor
- ๐ i18n - Multi-language support (English, Chinese, Japanese, Korean, etc.)
- ๐๏ธ Workspace Persistence - File explorer root path restored between sessions
- ๐ช Smart Window Behavior - Open files and folders in new windows when needed




๐ Quick Start
Prerequisites
- Bun 1.0+
- macOS 11+, Windows 10+, or Linux
Installation
# Install dependencies
bun install
# Development without HMR (uses bundled assets)
bun run dev
# Development with HMR (recommended)
bun run dev:hmr
macOS Note
Since MarkBun is not yet code-signed, macOS Gatekeeper may show a "damaged" warning. Run this command after installing:
xattr -cr /Applications/MarkBun.app
Build
# Build for canary release
bun run build:canary
# Build for stable release
bun run build:stable
How HMR Works
When you run bun run dev:hmr:
- Vite dev server starts on
http://localhost:5173with HMR enabled - Electrobun starts and detects the running Vite server
- The app loads from the Vite dev server instead of bundled assets
- Changes to React components update instantly without full page reload
When you run bun run dev (without HMR):
- Electrobun starts with file watch and loads from
views://mainview/index.html - You need to rebuild (
bun run build:canary) to see changes
๐๏ธ Tech Stack
| Technology | Purpose |
|---|---|
| Milkdown | WYSIWYG Markdown editor core |
| Electrobun | Cross-platform desktop framework |
| CodeMirror | Source mode editor |
| Bun | JavaScript runtime and bundler |
| TypeScript | Type-safe development |
| Tailwind CSS | Utility-first styling |
| Zod | Settings schema validation |
| i18next | Internationalization |
๐ Project Structure
markbun/
โโโ src/
โ โโโ bun/ # Main process (Electrobun/Bun)
โ โ โโโ index.ts # Main entry point and RPC handlers
โ โ โโโ menu.ts # Application menus
โ โ โโโ services/ # Backend services (settings, backup, uiState)
โ โ โโโ ipc/ # IPC handlers
โ โ
โ โโโ mainview/ # Renderer process (WebView)
โ โ โโโ components/ # React components
โ โ โ โโโ editor/ # Milkdown/Crepe editor wrapper
โ โ โ โโโ file-explorer/# File explorer sidebar
โ โ โ โโโ layout/ # Toolbar, StatusBar, TitleBar, Sidebar
โ โ โ โโโ outline/ # Outline navigation
โ โ โ โโโ quick-open/ # Quick Open dialog
โ โ โ โโโ settings/ # Settings dialog
โ โ โ โโโ recovery-dialog/ # Crash recovery dialog
โ โ โ
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ lib/ # Utilities and helpers
โ โ โโโ i18n/ # Internationalization (8 locales)
โ โ โโโ styles/ # Global styles
โ โ โโโ main.tsx # React entry point
โ โ โโโ App.tsx # Main App component
โ โ โโโ index.html # HTML entry
โ โ
โ โโโ shared/ # Shared types, settings schema, command registry, and utilities
โ
โโโ docs/ # Documentation
โ โโโ architecture.md # Architecture overview
โ
โโโ electrobun.config.ts # Electrobun configuration
โโโ vite.config.ts # Vite configuration
โโโ tailwind.config.js # Tailwind configuration
โโโ package.json
โโโ README.md
๐ฎ Usage
Basic Editing
- New File:
Cmd/Ctrl + N - Open File:
Cmd/Ctrl + O - Save:
Cmd/Ctrl + S - Save As:
Cmd/Ctrl + Shift + S
Interface Controls
MarkBun uses a chromeless interface โ all toolbars and UI elements are hidden by default for distraction-free writing. Toggle UI elements via the View menu or shortcuts:
| UI Element | Menu Command | Default State |
|---|---|---|
| Title Bar | View โ Show Title Bar | Hidden |
| Toolbar | View โ Show Tool Bar | Hidden |
| Status Bar | View โ Show Status Bar | Hidden |
| Sidebar | View โ Show Sidebar | Hidden (Cmd/Ctrl + Shift + B) |
| Dark Mode | View โ Toggle Dark Mode | Cmd/Ctrl + Shift + D |
| Source Mode | View โ Toggle Source Mode | Cmd/Ctrl + / |
| Settings | MarkBun โ Preferences | Cmd/Ctrl + , |
Formatting Shortcuts
| Action | Shortcut |
|---|---|
| Bold | Cmd/Ctrl + B |
| Italic | Cmd/Ctrl + I |
| Inline Code | Cmd/Ctrl + Shift + C |
| Strikethrough | Cmd/Ctrl + Shift + ~ |
| Highlight | Cmd/Ctrl + Shift + H |
| Inline Math | Ctrl + M |
| Link | Cmd/Ctrl + K |
| Image | Cmd/Ctrl + Shift + I |
Paragraph Shortcuts
| Action | Shortcut |
|---|---|
| Heading 1-6 | Cmd/Ctrl + 1/2/3/4/5/6 |
| Paragraph | Cmd/Ctrl + 0 |
| Increase Heading Level | Cmd/Ctrl + = |
| Decrease Heading Level | Cmd/Ctrl + - |
| Bullet List | Alt + Cmd/Ctrl + U |
| Ordered List | Alt + Cmd/Ctrl + O |
| Task List | Alt + Cmd/Ctrl + X |
| Quote | Alt + Cmd/Ctrl + Q |
| Code Block | Alt + Cmd/Ctrl + C |
| Math Block | Alt + Cmd/Ctrl + B |
| Horizontal Rule | Alt + Cmd/Ctrl + - |
| Table | Alt + Cmd/Ctrl + T |
๐จ Customization
Settings
Settings are stored in ~/.config/markbun/settings.json:
{
"__version": 1,
"general": {
"autoSave": true,
"autoSaveInterval": 2000,
"language": "en"
},
"editor": {
"fontSize": 15,
"lineHeight": 1.65
},
"appearance": {
"theme": "system",
"sidebarWidth": 280
},
"backup": {
"enabled": true,
"maxVersions": 20,
"retentionDays": 30,
"recoveryInterval": 30000
}
}
UI state is stored separately in ~/.config/markbun/ui-state.json:
{
"showTitleBar": false,
"showToolBar": false,
"showStatusBar": false,
"showSidebar": false,
"sidebarWidth": 280,
"sidebarActiveTab": "files",
"windowX": 200,
"windowY": 200,
"windowWidth": 1200,
"windowHeight": 800
}
The window position and size are automatically saved and restored on restart. If the saved position is outside the visible screen area (e.g., when a monitor is disconnected), the window will be reset to a safe default position on the primary display.
Multi-Monitor Support
MarkBun fully supports multi-monitor setups:
- Window position is saved per display
- Automatically detects when a display is disconnected
- Falls back to primary display when the original display is unavailable
- Validates window visibility before restoring to ensure the window is always accessible
๐ ๏ธ Development
Scripts
bun run dev # Start development with file watch
bun run dev:hmr # Start development with HMR (recommended)
bun run build:canary # Build canary release
bun run build:stable # Build stable release
bun run test # Run tests once
bun run test:watch # Run tests in watch mode
bun run test:coverage # Run tests with coverage
bun run lint # Run typecheck and tests
Adding Milkdown Plugins
bun add @milkdown/plugin-math
๐งช Testing
Running Tests
MarkBun uses Bun's built-in test runner:
# Run all tests
bun test
# Run tests in watch mode (during development)
bun run test:watch
# Run tests with coverage report
bun run test:coverage
Editor Module Tests
After refactoring, the editor module has comprehensive unit tests:
tests/unit/components/editor/
โโโ types.test.ts # Type definition tests
โโโ utils/
โ โโโ tableHelpers.test.ts # Table utility tests
โ โโโ editorActions.test.ts # Editor action tests
โโโ hooks/
โ โโโ index.test.ts # React hooks tests
โโโ commands/
โโโ formatting.test.ts # Formatting command tests
โโโ paragraph.test.ts # Paragraph command tests
โโโ table.test.ts # Table command tests
Test Directory Structure:
- Tests are in
tests/unit/mirroring thesrc/structure tests/unit/setup.ts- Test helper for simplified imports- Future:
tests/integration/andtests/e2e/for other test types
Simplified Imports:
// Import from setup.ts instead of long relative paths
import { isTableCell, toggleBold } from '../setup';
Writing Tests
When modifying the editor, you must run tests:
# Before committing
bunx tsc --noEmit # Type check
bun test # Run all tests
Test naming convention:
should [expected behavior] when [condition]- Example:
should return false when editor is not initialized
Test Coverage
Minimum coverage requirements:
- Utils: 90%+
- Commands: 80%+
- Hooks: 70%+
Generate coverage report:
bun test --coverage
โ ๏ธ Known Issues
- Windows double cursor on high-DPI displays: On Windows 11 with display scaling above 100% (e.g., 150%), the app may show two mouse cursors โ one normal and one enlarged. This is caused by a missing DPI awareness declaration in the Electrobun framework (electrobun#324). Awaiting an upstream fix.
- No native file association support: Double-clicking a
.mdfile or dragging files onto the app icon does not open them (electrobun#304). On macOS, this is partially worked around with an AppleScript droplet wrapper. Windows remains unresolved. - Windows garbled text for non-ASCII languages: Menu labels and file dialogs show garbled text for Chinese, Japanese, and other non-ASCII characters on Windows. This is caused by Electrobun using ANSI Win32 APIs instead of Unicode (Wide) APIs (electrobun#335). Awaiting an upstream fix.
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Roadmap
v0.1.0 (MVP) โ Completed
- Basic WYSIWYG editing
- File open/save
- Markdown syntax support
- Dark mode
v0.2.0 โ Completed
- File explorer sidebar
- Outline navigation
- Image drag & drop
- Quick Open (Ctrl/Cmd+P)
- Recent files
v0.3.0 โ Completed
- Table header styling
- Auto-save (with hybrid throttle/debounce strategy)
- Settings UI (General, Editor, Appearance tabs)
- UI state persistence (sidebar width, visibility)
- Theme management (light/dark/system)
- Multi-monitor support with display detection
v0.4.0 โ Completed
- Three-layer file protection (atomic write, crash recovery, version history)
- Export to PNG image
- Export to HTML
- Math equations (LaTeX inline and block support)
v0.5.0 โ Completed
- Find & Replace with search highlighting (WYSIWYG and code blocks)
- Unified Command Palette (Ctrl/Cmd+P)
- Session persistence (cursor/scroll position restore)
- Windows platform support (menu bar, icons, CI)
v0.6.0 โ Completed
- AI Chat Assistant with streaming responses
- Multi-provider support (OpenAI, Anthropic, Google, Ollama, DeepSeek, etc.)
- Document editing tools (read, edit, write)
- Session history persistence and management
v0.7.0 โ Completed
- Mermaid diagram viewer with zoom and pan
- HTML block rendering with DOMPurify preview support
- Frontmatter display support
- Source mode support for undo/redo/copy/cut/select-all
- AI tools image path conversion
- Command manifest unification and i18n consolidation
v0.8.0 โ Completed
- Mermaid hover-to-viewer and fit-to-window
- Editor code block copy/paste fixes
- HTML block fenced code misidentification fix
- Chunked loading boundary fix for fenced code blocks
- File explorer root path persistence
- New-window file/folder open behavior
- AI edit/write auto-save sync
- Windows NSIS installer
v1.0.0
- Stable release
๐ TODO
Features under consideration for future releases:
- Focus Mode (distraction-free writing)
- Document Statistics (word count, writing speed)
- Typewriter Mode (cursor centered)
- Custom Themes
- Advanced Keybindings
- Accessibility Support
- Performance Optimization (large files)
- Cross-platform Distribution (macOS/Windows/Linux)
- Workspace Management
- Tabbed Editing (multiple documents)
- Auto Updater
- Cloud Sync (iCloud, Dropbox, OneDrive, Google Drive)
- Final Polish
- Plugin System
- Git Integration
- Real-time Collaboration
๐ License
MarkBun is licensed under the MIT License.
๐ Acknowledgements
- Milkdown - The amazing WYSIWYG markdown framework
- Electrobun - Ultra-fast desktop framework
- CodeMirror - Source mode editor
- ProseMirror - The foundation of Milkdown
- Typora - Inspiration for the editing experience
Made with โค๏ธ by @xiaochong