finds.dev← search

// the find

antonmedv/codejar

★ 1,965 · TypeScript · MIT · updated Oct 2025

An embeddable code editor for the browser 🍯

CodeJar is a minimal browser-based code editor built on contenteditable, weighing in at 2.45 kB gzipped with zero dependencies. It handles indentation, bracket closing, and undo/redo, delegating syntax highlighting entirely to whatever library you bring (Prism, highlight.js, etc.). Aimed at anyone who needs a lightweight embedded editor without pulling in CodeMirror or Monaco.

1. The size constraint is real and enforced — the entire implementation is two files (codejar.ts, cursor.ts), so you can read and understand the whole thing in an afternoon. 2. Bring-your-own-highlighter design is genuinely smart: no opinion on languages, no bundled grammars, works with anything that mutates innerHTML. 3. The cursor position save/restore API is a thoughtful detail — contenteditable cursor management is notoriously painful and exposing it explicitly is the right call. 4. No framework dependency and no build step required to use it, which matters for embedding in non-SPA contexts.

1. Built on contenteditable, which means you inherit a decade of browser quirks around IME input, copy-paste from rich text, and mobile keyboard behavior — none of which are handled here. 2. The highlighting function receives and mutates innerHTML directly, which is an XSS footgun if the highlighter ever outputs user-controlled content without sanitizing. 3. No virtual scrolling or line virtualization means performance degrades on large files — this is fundamentally not suited for anything beyond small snippets. 4. The community wrappers (React, Angular) are third-party and unmaintained-looking; if you need framework integration, you're writing it yourself.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →