# Eat The Richtext

A year and a half ago I vibe-coded a tool, [Eat The Richtext](https://eat-the-richtext.dreev.es/), that I've been using practically every day[^qzhz3i683q] ever since. Friends tell me they continue to use it as well. I think that means it's time for it to graduate from the [blurb I put on LessWrong](https://www.lesswrong.com/posts/PLMKKfJufCX68Dsvb/dreeves-s-shortform?commentId=7pvvHtgqnHD3RMAWM) to a proper LessWrong post.

Ok, you know how sometimes you copy/paste a chunk of text into Discord or GitHub Issues or a text message or anywhere else that doesn't support rich text (aka RTF)? And then alllll of the following formatting disappears?

1.  *Italics* and **bold**
2.  Sub- or superscripts, like *a*^2^ \+ *b*^2^ = *c*^2^
3.  The numbers in a numbered list
4.  The bullets in a bulleted list
    1.  Also nesting of lists
5.  Hyperlinks like [eat-the-richtext](https://eat-the-richtext.dreev.es)
6.  | Tables | Chairs |
    | --- | --- |
    | data | electric |
    | furniture |     |
    
7.  Headers and subheaders
8.  Blockquotes
9.  ~~Strikethrough~~
10.  `<Code>`

It's the italics that are insidious in particular, since they're hard to reliably spot and the meaning of the text can (occasionally) totally change if they're stripped. This drives me *bananas*.

If you use various editors that support markdown, like Obsidian or Notion, they may have the solution to this built in. Copy the rich text in, copy markdown back out.

The rest of us can use this thing:

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/3649419f367059303e5a4b82a802430f5ab9acae249880d4.png)

That's what you see if you just copy the list above and paste it into the textarea on the left at, let me link you to it one more time, [eat-the-richtext.dreev.es](https://eat-the-richtext.dreev.es). The equivalent markdown magically appears on the right. You can click that little copy button to copy the markdown (or just select-all + copy) and then paste it into whatever plaintext-loving place you like.

(Notice that list numbering doesn't quite play nicely with having a table in the list. I'm working on that. But I don't think this problem is unique to Eat The Richtext. Google Docs also misunderstands the numbering, though a bit less badly, when you paste that list in.)

If you tried to copy that richtext from here in LessWrong directly to, say, Discord, you'd see this travesty:

> And then all of the following formatting disappears?
> 
> Italics and bold
> 
> Sub- or superscripts, like a2 + b2 = c2
> 
> The numbers in a numbered list
> 
> The bullets in a bulleted listAlso nesting of lists
> 
> Hyperlinks like eat-the-richtext.dreev.es
> 
> Tables
> 
> Headers and subheaders
> 
> Blockquotes
> 
> Strikethrough

Oy! Before this tool I would usually paste that abomination and then manually markdownify it, double-checking to make sure I didn't miss any italics and painstakingly adding the asterisks and whatnot. Now I let the rich text eater work its magic.

Or if you're a weirdo who likes WYSIWYG you can use the left side as an editor and see the corresponding markdown on the right. Or vice versa. You can even jump back and forth, like if you forget the markdown syntax for something. Whatever you like!

It all happens automatically in real time as you paste or type and I think is plenty self-explanatory.

Colophon
--------

For posterity, here's my original prompt that I gave ChatGPT (4o) in May of 2024:

> can you build a simple html/javascript app with two text areas. the top text area is for rich text (rtf) and the bottom for plaintext markdown. whenever any text in either text area changes, the app updates the other text area. if the top one changes, it converts it to markdown and updates the bottom one. if the bottom one changes, it converts it to rich text and updates the top one.

I won't say it one-shotted it, but with some hours of back-and-forth (15 hours total, but that includes writing this blog post), it got something usable without me writing any of the code. I was pretty blown away at the time. I've now had Codebuff helping to improve it.

PS: Have a referral link to [Codebuff](https://www.codebuff.com/referrals/ref-146ce36c-53e8-435c-a7f6-e180206dd0ee), a rationality-community-originating coding assistant (originally Manicode, spun out of Manifold Markets). Trying it via that link gets us both free credits.

PPS: The [source code is on GitHub](https://github.com/dreeves/eat-the-richtext). And I should mention that Eat The Richtext is fully client-side. No backend and no concern with pasting in private text.

*Thanks to* [*Serine Molecule*](https://www.lesswrong.com/users/serine) *and Codebuff and Claude Code for help getting GitHub-flavored markdown tables to finally work.*  
 

[^qzhz3i683q]: A few times over the last year and a half I got out of the habit of using Eat The Richtext and would find myself tediously reformatting and reitalicizing text after pasting to some plaintext-only place. Lately I have it in my bookmark bar and use it all the time again. Hopefully "eat the richtext" is memorable enough, and, with this post, googlable enough to find it next time you find yourself markdownifying lost formatting, or noticing too late that you turned a sentence like "Neil didn't steal Mike's bike" into "Neil didn't steal Mike's bike".