I'm working on a piece of my Next.js app, and I'd love to create a section that allows for users to write simple HTML and CSS and compiles the results, displaying them in browser. Similar to the editor pages on W3.
I don't have much to go on in terms of what I've tried, as this is a completely new concept for me, but from the little I've seen in other similar tools, you can compile the code into a Blob()
and then set that Blob()
as the src
for a iframe
.
How to create an in-browser HTML compiler like this, preferably easily compatible with React/Next.js?