Home / PWA and Offline / Local Markdown Editor

Local Markdown Editor in JavaScript, Free with Live Demo

Free Markdown editor in plain JavaScript. Open and save real .md files with the File System Access API, see a live preview, and keep drafts. Includes a small parser.

Open live demoDownload HTML fileView code on GitHub
Local Markdown Editor JavaScript project: a Markdown editor that saves real files on your disk

Runs on: File System Access. Direct file saving: Chrome and Edge on desktop. Other browsers download a copy instead.

What is the Local Markdown Editor?

Open a .md file from your computer, edit it with a live preview next to it, and press Ctrl S to save straight back to the same file. It feels like a desktop app, but it is a single web page.

Saving uses the File System Access API, which gives the page a handle to a real file after you pick it. The preview comes from a small Markdown parser in the project that escapes HTML first for safety.

Good for

  • Writing notes and docs
  • Editing README files
  • Learning how Markdown parsers work
  • Offline writing tools

What this project does

How it works

  1. Get a file handleThe picker returns a handle to the real file. The page keeps it so later saves need no dialog.
  2. Render as you typeEach keystroke runs the parser, which escapes HTML first and then adds Markdown formatting.
  3. Write backhandle.createWritable() streams the new text into the same file on disk.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

// Open a real file and keep its handle
const [handle] = await showOpenFilePicker({
  types: [{ description: "Markdown", accept: { "text/markdown": [".md"] } }],
});
editor.value = await (await handle.getFile()).text();

// Later: save back to the same file, no dialog
const writable = await handle.createWritable();
await writable.write(editor.value);
await writable.close();

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

What is the File System Access API?

It lets a web page open and save files on your computer after you pick them, so you can edit a file in place instead of downloading copies.

Which browsers can save files directly?

Chrome and Edge on desktop. In other browsers Save downloads a copy of the file instead.

Which Markdown features are supported?

Headings, bold, italic, links, images, lists, quotes, code blocks, tables and horizontal lines. That covers most READMEs and notes.

More PWA and Offline projects