IonBin
All pages
Search
Draft, pending editorial review · not indexed

Build your own Markdown editor with AI assist

Beginner to intermediate · a weekend · checked 2026-10-18

A local-first Markdown reader, writer and editor: live preview, open and save files on your own disk, optional AI help for drafting and cleanup, and an optional MCP hook so your agents can read your notes. Start as a single web page, then wrap it as a desktop app.

What you’ll build

A Markdown app for your own files: a split view with the source on the left and a live preview on the right, open and save straight to disk, light and dark themes, word counts and HTML export. Add an AI assistant for drafting, rewriting and tidying, and optionally let your AI agents read the same folder through MCP.

IonBin’s founder built a prototype as a zero-dependency, single HTML file that opens in a chromeless browser window, so it feels like a desktop app with nothing to install. This guide starts with that approach; a Tauri or Electron wrapper comes later if you need it.

Architecture and data flow

  1. Editor pane (a textarea or a code-editor component) holds the Markdown text.
  2. Parser converts Markdown to HTML on every change; the preview renders that HTML after sanitizing it.
  3. File layer opens and saves .md files. Browser showOpenFilePicker and showSaveFilePicker have limited availability and require a secure context and user activation. Feature-detect them; offer a file-input and download fallback when direct save is unavailable. In a desktop wrapper, the app reads and writes through the wrapper’s file APIs.
  4. AI assist (optional) sends the selected text plus an instruction to a model you choose and shows the suggestion as a diff you accept or reject. Design and test it so no text is sent without an explicit request.
  5. MCP hook (optional) exposes only an explicitly permitted folder through a configured read-only MCP service. Enforce path boundaries, including symlink handling, in code rather than relying on a prompt.

Components and why

Component Options Why
Shell Single HTML file → Tauri → Electron Start with zero install; Tauri gives a small native app with a Rust core; Electron bundles Chromium and Node
Markdown A CommonMark/GFM-compliant parser Predictable output; GFM adds tables and task lists
Files File System API (browser) or desktop file APIs Local storage is possible; AI requests, remote preview assets and GitHub sync are separate data transfers
AI assist A compatible model API with separate billing and authentication Bring your own model and key; keep it optional
Version history Git + GitHub Committed versions are reviewable; uncommitted edits still need autosave and backups

Step outline

  1. Create a GitHub repository and write a one-page spec: features, keyboard shortcuts, what “done” means.
  2. Ask your coding agent for a single-file prototype: editor, live preview, open/save with Ctrl+O and Ctrl+S, themes.
  3. Test the parser before you trust it. Check headings, bold and italic, nested lists, task lists, tables, fenced code, links and images, plus edge cases such as an asterisk inside backticks staying literal. Keep these as automated tests.
  4. Test incomplete documents. An unclosed fenced code block is valid GFM and continues to the end of its containing block or document. Test it, empty input and rapid edits against the chosen parser; do not assume a particular null-handling patch fixes every parser.
  5. Sanitize the preview HTML with a maintained sanitizer and a restrictive policy. Block active content and unexpected URL schemes. Decide whether remote images may load, since they can contact another server even without an AI request.
  6. Add AI assist behind a button with a clear provider/data notice. Never embed a shared secret in distributed browser code. Choose a protected desktop credential store or an authenticated backend with per-user limits; model selection alone does not secure a key.
  7. Wrap it as a desktop app with Tauri or Electron if you need menus, file associations or auto-update.
  8. Optional MCP: test allowed and denied paths using a separate read-only credential; add write tools only with enforced authorization, conflict detection and recovery.

AI platforms that help

This is a small, front-end-heavy build, so the agent that lives in your editor matters most. Cursor suits the live-preview loop (edit, check in the built-in browser, repeat). Claude Code fits scaffolding the file-system layer and the test suite from the terminal. OpenAI Codex can take the desktop packaging step as a background task once the web version works. Google Antigravity can run the UI and storage pieces as parallel agents. Keep the code in a GitHub repository from day one so every agent change arrives as a reviewable diff; the platform comparison lists what each one documents.

Costs

  • A local prototype need not incur a hosting fee. Development, dependencies, signing, distribution and any remote services can still cost money.
  • AI assist is billed by your model provider per use. To verify: current per-token prices on your provider’s pricing page.
  • Desktop distribution may need a code-signing certificate. To verify for your platforms.

Risks

  • Data loss: test failed saves, cancellation, external file changes and recovery. Use atomic replacement where the chosen filesystem API supports it, plus backups; Git only preserves committed content.
  • Script injection through the preview if HTML isn’t sanitized.
  • Privacy: any text sent to an AI provider leaves your machine; make it opt-in and visible.
  • Browser support: save-in-place depends on the browser; check before you rely on it.

Sources

Official docs and specifications are listed below. Practitioner notes draw on prototype development; they do not establish a tested implementation of every step in this guide.

Source list

To verify Test supported browsers and direct-save fallback, failed-save recovery and preview sanitization. · Verify model billing and credential storage, desktop signing and MCP path controls for the chosen implementation.

Related in the wiki