OverType is a transparent textarea over rendered markdown.
Plain text simplicity, WYSIWYG beauty, zero complexity.
Everything just works: undo/redo, mobile keyboards, native selection - because it's really a textarea.
<script src="https://unpkg.com/overtype"></script>
<div class="editor"></div> <div class="editor"></div>
new OverType(".editor");
That's it. No npm. No build. No config.
// The entire trick: layerElements(textarea, preview) // Position textarea over preview applyIdenticalSpacing(textarea, preview) // Match fonts, padding, line-height exactly // Make textarea invisible but keep the cursor textarea.style.background = 'transparent' textarea.style.color = 'transparent' textarea.style.caretColor = 'black' // Keep them in sync textarea.addEventListener('input', () => { preview.innerHTML = parseMarkdown(textarea.value) syncScroll(textarea, preview) }) // That's it. Everything else is polish.
That's it. A transparent textarea over a preview div. No virtual DOM. No ContentEditable. No magic.
OVERTYPE | OTHER EDITORS |
---|---|
45KB total | 300-500KB + dependencies |
Minutes to understand | Hours to understand |
Minutes to customize | Days to customize |
It's a textarea | 12 pages of docs |