Code Diff

Unified diff view computed server-side via Python difflib. Added lines have a green left border and fade-in background; removed lines have red. Unchanged context lines are neutral. Optional line numbers, language badge, and title. No JavaScript required — diff is computed at render time, not in the browser.

Surfaces
webmeet-stagegas-sidebarapps-script-web
Degraded on
SurfaceNote
googlechatRenders as plain monospace text block; no colour highlighting.
pdfRenders as a static diff without colour; additions and removals shown with +/- prefix only.
Fields
FieldType
old_codestring. The original text (before state).required
new_codestring. The updated text (after state).required
labelstring. Title shown in the header bar.optional
languagestring. Language badge shown in header, e.g. "python", "typescript".optional
show_line_numbersbool. Show line numbers. Default true.optional
context_linesinteger. Unchanged lines shown around each change. Default 3.optional
Example payload
{
  "type": "code_diff",
  "old_code": "Old code",
  "new_code": "New code"
}
ARD catalog entry
{
  "identifier": "urn:air:a2uicatalog.ai:atom:code_diff",
  "displayName": "Code Diff",
  "type": "application/vnd.a2ui.atom+json",
  "url": "https://a2uicatalog.ai/atoms/code_diff",
  "capabilities": [
    "web",
    "meet-stage",
    "gas-sidebar",
    "apps-script-web"
  ],
  "description": "Unified diff view computed server-side via Python difflib. Added lines have a green left border and fade-in background; removed lines have red. Unchanged context lines are neutral. Optional line numbers, language badge, and title. No JavaScript required \u2014 diff is computed at render time, not in the browser.",
  "representativeQueries": [
    "show a server-side unified diff view with green additions and red removals",
    "unified diff view computed server-side via python difflib. added lines have a green left border and",
    "render a code diff"
  ]
}
← Full ARD catalog Try it live →
Deploy your own renderer

The renderer is open source. Deploy your own instance in 4 commands — you own the URL, no dependency on the demo endpoint.

git clone https://github.com/a2uicatalog/a2ui
cd apps-script-surface/gas-schema-renderer
clasp push && clasp deploy
Full deploy guide →