# A Markdown editor that is one HTML file and an autosave timer

> Lengyi's editor inlines its styles and logic into a single markdown-editor.html you double-click to open, saves to localStorage every 500 milliseconds, renders with marked.js, KaTeX and Mermaid, and speaks ten languages from a separate dictionary file. Its LICENSE is MIT while the README adds a commercial-use restriction that MIT does not permit.

**woyin2024/lengyi-markdown-editor** — 一个纯前端的极简Markdown编辑器，单HTML文件，打开即用，完全免费。A minimalist browser-based Markdown editor in a single HTML file. Live preview, auto-save, distraction-free writing.

- Repository: https://github.com/woyin2024/lengyi-markdown-editor
- Stars: 484 · Forks: 93
- Language: HTML
- License: MIT
- Published: 2026-09-17 · Updated: 2026-09-17 · Language: en
- Canonical page: https://hysenlabs.com/projects/woyin2024-lengyi-markdown-editor

## One file, a textarea and a 500ms timer

The whole editor is `markdown-editor.html` with styles, structure and logic inlined, so double-clicking it works with no server and no network. Authoring is deliberately plain: a textarea on the left, marked.js rendering on the right, updated as you type. Auto-save writes to browser localStorage every 500 milliseconds, and the saved state covers content, filename, the split ratio, collapsed states, theme and language, so a refresh loses nothing. Stated in plain terms in the README, the design brief is that other Markdown tools were too heavy, charged subscriptions, or synced content to a cloud without asking.

## MIT in the LICENSE file, a restriction in the README

The licence needs reading twice. An MIT LICENSE file sits in the repository, and the README says the project is licensed under the MIT License and that you are free to use, modify and distribute. The next sentence then asks you to obtain authorization for commercial use. Those two statements cannot both hold: MIT grants use for any purpose, including commercial, and adding a condition to it is not something the licence permits. Until that paragraph is corrected, anyone planning to put the editor inside a product has to decide which document they are relying on, and the conservative reading is that the README condition is not enforceable rather than that the MIT grant has been narrowed.

## The single file has a companion dictionary

One HTML file is the claim, and it is nearly true. Rendering, editing and export are all inlined, but the translations live in `i18n.js`, a separate file holding ten languages: Simplified and Traditional Chinese, English, Japanese, Korean, Spanish, French, German, Russian and Portuguese, with the choice persisted to localStorage. So a strict reading of single-file means shipping the page and its dictionary together. The repository also holds `web-to-md-proxy.py` and a `public/` directory with Chinese-named assets such as an about-the-author note and two screenshots, and a second README in Simplified Chinese.

## Export paths that include Word and a long image

Five export formats are offered. `.md` writes the raw Markdown, `.html` produces a standalone page, `.doc` is presented as a Word document that opens in Office, `.pdf` goes through the browser's print-to-PDF, and `.png` is a long-image capture at 9:16, 4:5, 3:4, 1:1 and 16:9 for social posts, rendered through dom-to-image-more. Images can be embedded as Base64 straight from disk, which makes a document self-contained and also makes the file large fast. Editing goes well beyond the basics: H1 to H6 insertion, the usual inline styles including strikethrough, superscript and subscript, task lists, blockquotes, fenced code, an 8 by 8 visual table picker, find and replace, and a raw source mode.

## KaTeX and Mermaid inside a plain textarea

What the editor does not do is hide the Markdown. Math is rendered with KaTeX, inline between dollar signs and block between double dollar signs, and diagrams come from Mermaid 10 for mind maps and flowcharts, both inside the same preview pane as the prose. The layout is adjustable in three shapes, edit with preview, edit only, or preview only, and the divider between them is draggable with the position remembered. Ten keyboard shortcuts cover the common actions, from Ctrl+S to save and Ctrl+B for bold through Ctrl+K for a link and Ctrl+Shift+K for an image, with Tab inserting a four-space indent.

## The webpage-to-Markdown path needs Python

One feature breaks out of the single-file model: turning a live web page into Markdown. That runs through `web-to-md-proxy.py`, a small local server you install `requests` for and start on port 8765, after which you tick a Use local proxy box in the editor. A local process is needed because a browser cannot fetch an arbitrary page and hand over the DOM under the same-origin policy, so a local process does the fetching. For local writing you can skip both, though a local HTTP server is the recommended route:

```bash
cd markdown-editor
python -m http.server 8080
npx serve .
```

Either one serves the folder on port 8080, and you open the editor at that address rather than from the file system.

## Where this editor is the wrong tool

The storage decision is the whole trade. Everything lives in one browser profile's localStorage, which means no sync between machines, no collaboration, no version history beyond your own backups, and a hard dependency on the quota of a browser store that clearing site data erases without warning. The alternative approach is a desktop editor that writes Markdown into a folder you choose, where the files are the state, git can track them, and any other tool can open them. That approach is heavier to install, which is the trade the author set out to avoid. A second mismatch is format fidelity: a `.doc` written by a browser page is not the same artefact as a Word document saved by Word, and a long PNG capture is a picture of your draft rather than the draft.

## Conclusion

lengyi-markdown-editor fits someone drafting AGENTS.md and SKILL.md files who wants no install, no account and nothing synced to a cloud, and who is content to keep one browser profile as the storage layer. It does not fit collaborative editing, multi-machine work, or a commercial product until the licence question is settled. Verify two things first: what your localStorage quota is, since Base64 image embedding and a long draft both grow it, and which of the two conflicting licence statements you intend to rely on.

## FAQ

### How do I run the Lengyi Markdown editor?

Clone the repository and double-click markdown-editor.html, or serve the folder with python -m http.server 8080 or npx serve . and open http://localhost:8080/markdown-editor.html. The README recommends the local server route. The optional webpage-to-Markdown proxy runs separately with python web-to-md-proxy.py on port 8765.

### Where does the Lengyi editor store my writing?

In browser localStorage, written every 500 milliseconds. Content, filename, the split ratio, collapsed states, theme and language all survive a page refresh, and nothing is sent to a server.

### Which languages does the Lengyi editor support?

Ten, through the i18n.js dictionary: Simplified Chinese, Traditional Chinese, English, Japanese, Korean, Spanish, French, German, Russian and Portuguese. The preference is persisted to localStorage.

### Can I use the Lengyi editor for commercial work?

The LICENSE file is MIT, which permits commercial use, while the README says commercial use requires authorization. The two statements conflict, and MIT does not allow extra conditions to be imposed, so the restriction in the README is the part to resolve before shipping.

### What formats can the Lengyi editor export to?

Five: raw Markdown, standalone HTML, a .doc file that opens in Office, PDF through the browser print dialog, and long-image PNG at 9:16, 4:5, 3:4, 1:1 and 16:9 ratios for social sharing.

## Sources

- [Issues](https://github.com/woyin2024/lengyi-markdown-editor/issues)
- [License: MIT](https://github.com/woyin2024/lengyi-markdown-editor/blob/main/LICENSE)
- [README](https://github.com/woyin2024/lengyi-markdown-editor/blob/main/README.md)
- [woyin2024/lengyi-markdown-editor on GitHub](https://github.com/woyin2024/lengyi-markdown-editor)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/woyin2024-lengyi-markdown-editor
