Show HN: OverType – A Markdown WYSIWYG editor that's just a textarea

109 panphora 26 8/17/2025, 4:13:06 PM
Hi HN! I got so frustrated with modern WYSIWYG editors that I started to play around with building my own.

The problem I had was simple: I wanted a low-tech way to type styled text, but I didn't want to load a complex 500KB library, especially if I was going to initialize it dozens of times on the same page.

Markdown in a plain <textarea> was the best alternative to a full WYSIWYG, but its main drawback is how ugly it looks without any formatting. I can handle it, but my clients certainly can't.

I went down the ContentEditable rabbit hole for a few years, but always came to realize others had solved it better than I ever could.

I kept coming back to this problem: why can't I have a simple, performant, beautiful markdown editor? The best solution I ever saw was Ghost's split-screen editor: markdown on the left, preview on the right, with synchronized scrolling.

Then, about a year ago, an idea popped into my head: what if we layered a preview pane behind a <textarea>? If we aligned them perfectly, then even though you were only editing plain text, it would look and feel like you were editing rich text!

Of course, there would be downsides: you'd have to use a monospace font, all content would have to have the same font size, and all the markdown markup would have to be displayed in the final preview.

But those were tradeoffs I could live with.

Anyways, version 1 didn't go so well... it turns out it's harder to keep a textarea and a rendered preview in alignment than I thought. Here's what I discovered:

- Lists were hard to align - bullet points threw off character alignment. Solved with HTML entities (• for bullets) that maintain monospace width

- Not all monospace fonts are truly monospace - bold and italic text can have different widths even in "monospace" fonts, breaking the perfect overlay

- Embedding was a nightmare - any inherited CSS from parent pages (margin, padding, line-height) would shift alignment. Even a 1px shift completely broke the illusion

The solution was obsessive normalization:

    // The entire trick: a transparent textarea over a preview div
    layerElements(textarea, preview)
    applyIdenticalSpacing(textarea, preview)

    // 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)
    })
A week ago I started playing with version 2 and discovered GitHub's <markdown-toolbar> element, which handles markdown formatting in a plain <textarea> really well.

That experiment turned into OverType (https://overtype.dev), which I'm showing to you today -- it's a rich markdown editor that's really just a <textarea>. The key insight was that once you solve the alignment challenges, you get everything native textareas provide for free: undo/redo, mobile keyboard, accessibility, and native performance.

So far it works surprisingly well across browsers and mobile. I get performant rich text editing in one small package (45KB total). It's kind of a dumb idea, but it works! I'm planning to use it in all my projects and I'd like to keep it simple and minimal.

I would love it if you would kick the tires and let me know what you think of it. Happy editing!

---

Demo & docs: https://overtype.dev

GitHub: https://github.com/panphora/overtype

Comments (26)

skyzouwdev · 58s ago
This is honestly brilliant. I love how you leaned into the constraints instead of trying to hide them, and the transparent textarea trick is such a clever hack. The fact that you got it down to 45KB while keeping undo/redo, mobile keyboard, and accessibility makes it feel like a breath of fresh air compared to bloated editors. Definitely bookmarking this for my next project.
SamInTheShell · 8m ago
This is a nifty little project. If I wasn't already neck deep in blocknote adoption in a small experiment I'm doing, I'd be taking this for a spin.

I noticed on the site the really cool animation you got has a 1px solid border on one of the overlays in firefox. Figure you might care since it's clearly supposed to be flashy.

mmastrac · 28m ago
This is pretty nice, though I'd suggest you call it a transparent syntax highlighter.

For https://grack.com/demos/adventure/, I used a hidden <input text> for something similar. I wanted to take advantage of paste/selection and all the other goodies of text, but with fully-integrated styling.

Like you, I found that standard text input boxes were far more interesting than contentEditable because they're just so simple overall.

I think there's probably an interesting middle ground here where you render real markdown with the textarea effectively fully hidden (but still with focus), emulate the selection events of the rendered markup into the textarea, and basically get a beautiful editor with all the textarea solidness.

dchest · 28m ago
Looks good!

Some links I've collected in the past that describe this approach:

- https://css-tricks.com/creating-an-editable-textarea-that-su...

- https://github.com/WebCoder49/code-input

I believe https://grugnotes.com also does this for markdown.

janwilmake · 5h ago
Really cool! I just love the simplicity of it: has no drawbacks compared to regular textarea, but has lots of benefits. you basically improved textarea, by a lot!

I also made a similar thing a while ago called contextarea.com, maybe, I should add overtype!

ikurei · 56m ago
Having to use a monospaced font is a pretty big drawback. To me, it means I wouldn't use this for a product that wasn't intended for a techie programmer audience.

Not that it isn't a really cool project! I'm only saying it has clear drawbacks.

tomsmeding · 39m ago
In Firefox on Android, the bold font is wider than the upright and italic fonts, breaking alignment.

(It works fine in Chrome on the same Android phone. Android 16, Firefox 141.0.3)

garbageoverflow · 1h ago
If it were a WYSIWYG editor, there'd be previews for images. But it seems like it's just syntax highlighting for textareas. Nice project either way, but false advertising.
mosselman · 2h ago
Very cool! So simple, I love it.

One thing that would be great is a bit better support for lists (todos, unordered and ordered) where when you press enter once it will add another `-` or `- [ ]`, etc item and when you press it a second time it becomes a blank line.

Jonovono · 1h ago
Nice, I was playing around with Milkdown. it's pretty cool: https://milkdown.dev/playground. It's like a block editor like notion for markdown so you don't need the split pane markdown/preview either
philo23 · 1h ago
The first time I saw this technique was while trying to figure out how GitHub styled the keyword:value tokens in their search box. It's a very cool technique, and you've done a very nice job of integrating it with a markdown parser!

Only down side to it is that you cant apply any padding to the styled inline elements.

aschelch · 5h ago
Looks awesome. Like the simplicity. I'll keep that in mind for future project ;)

(Btw, there might be a typo on the landing page on the set up part. There is 2 times de <div> instead of the textarea i guess;))

Edit: and the link to the Github is brocken

panphora · 5h ago
The idea is that two instances of overtype would be initialized inside those divs!
sdairs · 19m ago
This is really nice
ingigauti · 3h ago
Great idea & solution

I noticed toolbar is missing from options doc, reason I went looking was if I could add my own custom button to the toolbar

maz1b · 52m ago
Nice job. How is this different than marked on npm?
jerpint · 52m ago
This is great! Gonna try this on my next project
cchance · 2h ago
is there a way to show the rendered preview (not with the markdown characters)
nm980 · 5h ago
Can you send the GitHub link again?

And how does this handle rendering larger documents?

octobereleven · 2h ago
Love this. Pretty much markdown on steroids!
knoopx · 1h ago
very nice!
nodesocket · 2h ago
Very cool. I’m gonna implement into my hobby project today and see how it goes.
breakfastduck · 2h ago
I really like the simplicity of this.

I have a couple projects I could see this being really useful in, at least as an option instead of pure plain text. I still feel like consumers don't like markdown though, it's frustrating.

One thing I noticed, when doing a list (bullet, numbered etc) it would be great if the list continued on barrage return (enter) - most general users would expect that I think.

Bengalilol · 2h ago
> That's it. No npm. No build. No config.

That's it, I am loving it.

sitkack · 1h ago
If it doesn't have an NPM build, it isn't a serious project. Not using anything w/o a build.
neilv · 5m ago
If it doesn't work with crack pipes, it's not a serious pharmaceutical.