Antigravity 2.11.0, released on August 26, 2026, renders HTML artifacts directly inside the chat. The official changelog puts it plainly: "Generative UI renders HTML artifacts inline in chat, with support for KaTeX math and Chart.js and Plotly charts." Math, bar charts, Plotly figures — they come to life in the preview pane instead of sitting there as a wall of markup.
The first thing I asked for was small: a bar chart of how many assets sit in each category of a wallpaper app I maintain. When you are sorting images into buckets, you periodically want to see whether nature has quietly grown to twice the size of abstract. A chart answers that in a glance; a table makes you read.
The file that came back was 512 bytes.
The code that actually draws the chart was not in it.
The rest of this piece follows the order you are likely to hit things in: the symptom, how to tell the causes apart, how to fold the file into one piece without breaking it, and how to decide whether folding is worth it. If you are here because a chart you shared shows up blank, the triage table is the place to start.
The whole thing fits in 512 bytes, and that is the problem
Here is the file, exactly as I used it:
<!doctype html>
<meta charset="utf-8">
<title>Category counts</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css">
<canvas id="c" width="640" height="320"></canvas>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js"></script>
<script>
new Chart(document.getElementById('c'), {
type: 'bar',
data: {
labels: ['nature', 'city', 'abstract', 'animal'],
datasets: [{ label: 'assets', data: [1840, 1220, 980, 640] }]
}
});
</script>One canvas, one call into Chart.js, and you get a perfectly presentable bar chart.
But the file is 512 bytes because the drawing code lives somewhere else. A <script src="..."> line is a request — please go fetch 205,125 bytes of library from this host — not the library itself. (That is the size of Chart.js 4.4.1's chart.umd.js as I fetched it from jsDelivr in November 2026.)
Inside the chat preview, that distinction never surfaces. It surfaces the moment the file leaves your machine.
Triage: why is the chart blank?
These are the checks I run, top to bottom, when a chart fails to appear somewhere other than the preview. Every one of them can be answered from the browser's developer tools — the Console and Network tabs.
| Symptom | Likely cause | How to confirm | Fix |
|---|---|---|---|
| A blank rectangle the size of the canvas | Chart.js never loaded | Console shows ReferenceError: Chart is not defined | Inline the library (below) |
| A red row in Network, nothing in Console | A proxy or extension is blocking the CDN | The chart.umd.js request is marked failed | Inline it, or host it on an allowed domain |
| Math renders, but the glyphs look wrong | KaTeX's CSS points at font files that did not load | fonts/KaTeX_*.woff2 requests fail in Network | Inlining the CSS alone does not help; drop it if you are not using math |
| After inlining, raw code appears as text mid-page | A </script inside the library closed the tag early | Search for the text just before the visible code | Escape it to <\/script before inserting |
| After inlining, a SyntaxError in Console | $& or $' in a replacement string got expanded | Fragments of the original HTML appear inside the script | Pass the replacement as a function (below) |
| The checker reports zero, yet it is still blank | A script builds a URL at runtime and loads it | Network shows a URL that is not in the HTML | Ask for HTML that does not load scripts dynamically |
The first row is the answer most of the time. What makes it awkward is that the page is not broken: the title renders and the layout holds. All the recipient sees is a blank rectangle where a chart should be, and in my experience people do not open the console for a chart someone sent them. They assume the data was missing and ask you about it.
Counting external references takes about twenty lines
Skimming for https:// by eye stops being reliable as soon as the file grows. References hide inside @import rules, CSS url() values, and import statements in <script type="module">. So I keep a small script around that does nothing but count them.
// selfcheck.mjs — count external references in an HTML file
import { readFileSync } from 'node:fs';
const html = readFileSync(process.argv[2], 'utf8');
const pats = [
/<script[^>]+src=["']([^"']+)["']/gi,
/<link[^>]+href=["']([^"']+)["']/gi,
/<img[^>]+src=["']([^"']+)["']/gi,
/@import\s+(?:url\()?["']([^"']+)["']/gi,
/url\(\s*["']?(https?:\/\/[^"')]+)["']?\s*\)/gi,
/(?:\bfrom|\bimport\s*\()\s*["']((?:https?:)?\/\/[^"']+)["']/gi,
];
const refs = new Set();
for (const p of pats) for (const m of html.matchAll(p)) refs.add(m[1]);
const remote = [...refs].filter((u) => /^(https?:)?\/\//.test(u));
console.log(`file=${process.argv[2]} bytes=${Buffer.byteLength(html)} refs=${refs.size} remote=${remote.length}`);
for (const u of remote) console.log(' REMOTE ' + u);
process.exit(remote.length ? 1 : 0);Run it against the file above (Node.js 22) and you get:
$ node selfcheck.mjs cdn.html
file=cdn.html bytes=512 refs=2 remote=2
REMOTE https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js
REMOTE https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.cssTwo references, exit code 1. The last pattern exists for ES modules imported straight from a CDN: an HTML file containing only <script type="module">import { Chart } from "https://esm.sh/chart.js@4.4.1";</script> comes back with remote=1.
The exit code is the point. If you have any step that saves generated HTML as an artifact, putting this in front of it stops a file that cannot travel from being saved in the first place. The habit of verifying agent output locally is the same one I described in Building a verification loop with the embedded terminal in Antigravity 2.10.0 — this checker is a one-line addition to that loop.
It is regex-based, so it will not catch the last row of the triage table: a script tag assembled at runtime through document.createElement('script'). For the kind of HTML I ask for, that has never come up, and I would rather have twenty readable lines than a parser.
Reproducing an unreachable CDN on your own machine
I checked what an unreachable host actually costs by pointing the hostname at a closed local port:
$ curl -sS -o /dev/null --connect-timeout 5 \
--resolve cdn.jsdelivr.net:443:127.0.0.1 \
https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js
curl: (7) Failed to connect to cdn.jsdelivr.net port 443 after 0 ms: Connection refusedRefused after 0 ms. There is not even a timeout to wait through.
In a browser, the same failure means the <script> never loads and execution moves on. new Chart(...) dies with Chart is not defined, and the <canvas> stays exactly what it was declared as: 640 by 320 pixels of nothing.
| Where it is opened | With external refs (512 bytes) | Self-contained (205,477 bytes) |
|---|---|---|
| Chat preview | Renders | Renders |
| Browser with network | Renders | Renders |
| Offline, on a plane | Blank | Renders |
| Corporate network blocking CDNs | Blank | Renders |
| Reopened months later | Depends on the CDN still serving it | Exactly as saved |
That last row is the one I care about most. The reason to keep a chart at all is to look at it again later. If it is blank in six months, keeping it accomplished nothing.
Working as an indie developer, the asset mix in my apps shifts slowly across years rather than weeks. Some imbalances only become visible when you put a chart from six months ago next to today's, so losing the older one is a real cost rather than a hypothetical.
Folding it into one file, without the replace biting you
All you are doing is swapping the <script src> line for the library's contents. First, fetch the same version the HTML references:
curl -sS -o chart.umd.js https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.js
wc -c chart.umd.js # 205125Then the replacement:
// inline.mjs — replace the CDN reference with the file itself
import { readFileSync, writeFileSync } from 'node:fs';
let html = readFileSync('cdn.html', 'utf8');
// A literal "</script" inside the library would close the tag early, so escape it
const js = readFileSync('chart.umd.js', 'utf8').replace(/<\/script/gi, '<\\/script');
// Pass the replacement as a function: as a string, $& and $' get special meaning
html = html.replace(
/<script src="https:\/\/cdn\.jsdelivr\.net[^"]*"><\/script>/,
() => '<script>' + js + '</script>'
);
html = html.replace(/<link rel="stylesheet" href="https:\/\/cdn\.jsdelivr\.net[^"]*">\n/, '');
writeFileSync('inline.html', html);There is no math in this chart, so the KaTeX stylesheet gets dropped rather than inlined. Keeping only what you use is what keeps the result reasonable.
Running the checker again:
$ node inline.mjs && node selfcheck.mjs inline.html
file=inline.html bytes=205477 refs=0 remote=0Zero external references, exit code 0. The file went from 512 bytes to 205,477 bytes, and nearly all of that is Chart.js itself.
The version where I passed a string
My first version passed '<script>' + js + '</script>' straight in as the second argument to replace. With Chart.js 4.4.1 it works fine, and because it worked, I did not question it for a while.
What changed my mind was preparing to fold a different library the same way. I paused and reread MDN's page on String.prototype.replace, and the part I had skimmed past was the special patterns: in a replacement string, $& means "the matched text" and $' means "everything after the match."
> "a".replace(/a/, "X$&Y")
'XaY'
> "a".replace(/a/, () => "X$&Y")
'X$&Y'Chart.js 4.4.1's chart.umd.js happens to contain none of those sequences — I counted, and found zero $&, $', or $1-style pairs. A minified bundle that did contain one would get the tail of your HTML copied into the middle of its code, and you would be hunting a SyntaxError inside a single 200,000-character line.
A step that worked once has only proven itself for that one input. These days the replacement is always a function, and </script always gets escaped first, regardless of which library is going in.
Two misconceptions worth clearing up
"Fetching the .min.js from jsDelivr gets you the official minified build." For Chart.js 4.4.1, not quite. Requesting chart.umd.min.js returns a 205,399-byte file whose header reads "Skipped minification because the original files appears to be already minified." The real chart.umd.js is already minified; the .min.js is an alias jsDelivr generates on the fly, and the same header warns against using SRI with it. For inlining, fetching chart.umd.js directly is the cleaner choice.
"An integrity attribute makes the CDN version safe to open offline." Subresource Integrity checks that what arrived is what you expected. It does nothing when nothing arrives. If you need the file to open offline, inlining is the only answer.
Sometimes leaving the references in is the right call
I do not inline everything. The split I use looks like this:
| Situation | What I do | Why |
|---|---|---|
| Glance at it once in chat, then move on | Leave it | The preview renders either way; inlining costs more than it saves |
| Still swapping libraries or tweaking options | Leave it | Re-inlining after every change is wasted motion |
| Sending it to someone | Inline | You do not know their network or their restrictions |
| Committing it or keeping it as a record | Inline | Reproducibility should not depend on a CDN |
| Planning to review it offline | Inline | It opens with no network at all |
| Dozens of charts on one page | Keep one local copy of the library beside them | 200 KB per chart adds up quickly |
Speed is not a reason either way. I timed three fetches of the bundle from the CDN: 0.099 s, 0.101 s, and 0.096 s. On any decent connection, that round trip is invisible.
The dividing line is simply whether the file is disposable. Keep the charts you glance at light, and make only the ones you keep heavy. That is all the decision needs.
One more note on versions. The examples here use Chart.js 4.4.1 and KaTeX 0.16.9. As of November 2026, npm lists Chart.js 4.6.1 and KaTeX 0.19.1 as latest, so when you have a new chart generated, check the version in its src and fetch that same version to inline. If the HTML and the library drift apart, the folded file may no longer look like the preview did.
Where you are likely to get stuck next
Once you start keeping folded charts, the next question is when the numbers in them are from. Putting the date in the filename alone saves a lot of guessing six months later.
The other is drift when an agent writes HTML unattended. The same request can produce a CDN version one day and an inlined version the next. That kind of silent change in an artifact's shape follows the same pattern I wrote about in Your UI is in Japanese. Your commit log isn't., and the remedy carries over: put a checker in front of the save step.
Since Generative UI landed, I ask for a quick chart far more often than I used to — and because it is easy, a few of those charts turn out to be worth keeping. Only those get the checker run on them. That has been enough.
Pick the last HTML file you had generated and run node selfcheck.mjs against it. Either it comes back remote=0, or you get a list — and either way, you will know right away whether it needs folding.