matthewdowney / rendergpt

A Chrome extension to render HTML/JavaScript/CSS from ChatGPT into iframes.
66 stars 2 forks source link

rendergpt

A Chrome extension to render HTML/JavaScript/CSS from ChatGPT into iframes.

Status: experimental.

See also: This is now live on the Chrome Web Store.

The extension adds a "render" button to any HTML or PlantUML code blocks in a ChatGPT conversation.

Clicking the button renders the HTML in an iframe, and allows selecting other code blocks (JavaScript, CSS) from the conversation for inclusion, mixing and matching sources.

rendering some HTML, CSS, and JavaScript

Installation

  1. Go to the releases page, download the latest rendergpt.*.zip file, and extract it.
  2. Open Chrome/Brave and navigate to chrome://extensions.
  3. Enable "Developer mode" in the top right.
  4. Click "Load unpacked" and select the zip file's extracted contents.

Examples

ChatGPT does pretty well with structured output. I've had success getting it to build diagrams with PlantUML syntax, draw SVGs of varying complexity, and of course compose HTML, CSS, and JavaScript.

Writing some interactive JavaScript: doing some JavaScript stuff

Generating a PlantUML diagram from source code: rendering some PlantUML

Ideas

Development

First, build the extension in development mode with the dev Babashka task:

$ bb dev

Or equivalently, via npm, npx shadow-cljs watch :app.

Second, load the public/ directory as an unpacked extension in Chrome/Brave.

Finally, start a ChatGPT conversation. The "render" button only appears for code blocks tagged "html" for now.

For some reason, ChatGPT sometimes tags HTML as "php" and requires a gentle reminder that we no longer use that technology by choice.