ingest_html
Parses raw HTML into a structured reference AST with design tokens, sections, and palette for faithful landing page adaptation or cloning.
Instructions
Parses an HTML string into a reference AST: title, description, og_image, language, and sections classified by role (header, hero, features, about, form, cta, gallery, testimonials, pricing, faq, footer, unknown) with headings, subheadings, paragraphs, images, ctas, links, form fields, and a size_hint (desktop section height in px — from the source CSS when explicit, else a content-volume estimate; set the rebuilt section's desktop height from it) — plus top colors, fonts, palette, and background_images. The palette is pulled from CSS custom-properties AND, for Tailwind-CDN pages (Google Stitch output), from the page's tailwind.config — which also yields design_tokens (the resolved spacing grid, corner radii, and type scale) so the rebuild matches the source's exact sizing and colors instead of guessing. Returns ~2-5KB (compact) or up to ~25KB (full). Use detail:'full' for clone-faithful rebuilds — it adds per-section blocks (cards/tiles/steps), li lists, gradients, images as { src, alt } objects, and widgets (the source HTML + CSS of composite mockups, to paste into ONE html-box). ABSOLUTE-CANVAS builder exports (LadiPage-family pages / Webcake-published HTML — bare positioned divs whose layout lives in per-id CSS rules) are AUTO-DETECTED and converted DETERMINISTICALLY into a ready-to-save Webcake source (folded into the response as source + clone_notes + clone_notice): a faithful 1:1 clone on the matching 420/960 canvas — save it straight to create_page instead of hand-rebuilding. The heavy per-element geometry is summarized to canvas_summary { builder, width, mobile_only, element_count, sections:[{id,height,elements}], popups }. External images in source are auto-hosted on save (no upload_images needed); clone_notes lists the few lossy approximations to patch_page afterward. Garbled Vietnamese mojibake (UTF-8 mis-read as Latin-1) is auto-repaired with a warning.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | Yes | Raw HTML of a page or a section. | |
| detail | No | Level of detail in the returned AST. Both levels also lift the design system from a `tailwind.config` block when present (Google Stitch / Tailwind-CDN pages keep the WHOLE design system there, not in CSS): `palette` is named by token (primary→#a43b38, surface-container-low→#f3f3f3 — map utility classes like text-primary/bg-surface-container-low back to it), `colors` is usage-ranked from the classes actually on the page, and `design_tokens` carries the resolved spacing grid, corner radii, and TYPE SCALE (e.g. display-lg→48px, xl→80px) — REBUILD from these tokens so sizing/spacing/color match the original. 'compact' (default) — backward-compatible ~2-5 KB shape with top colors/fonts from inline styles. 'full' — richer AST: CSS custom-property palette (design tokens by name), background_images from stylesheets, gradients, per-section blocks (repeating card/tile/step structures with title/body/image/cta), li lists, extended paragraphs, images as { src, alt } objects, and per-section widgets = { hint, html, css? } — the cleaned source HTML + matching CSS of composite visuals (phone/device mockup, chat thread, dashboard, browser frame) to rebuild VERBATIM as ONE html-box (inline the css; don't re-imagine the markup). Use 'full' for clone-faithful rebuilds. Image URLs found in the result (images, background_images, og_image) are the user's assets: re-host them via upload_images and reuse them in the generated page for BOTH intents (never hotlink, never replace them with search_images stock photos). NOTE: for absolute-canvas builder exports the deterministic `source` is returned regardless of detail. | |
| intent | No | How the caller intends to use the result. 'adapt' (default) — use as a layout reference and rewrite the TEXT for the user's brand (images from the reference are still re-hosted via upload_images and reused). 'clone' — keep text and images close to the original. For absolute-canvas exports the deterministic `source` is a clone either way. | |
| sections | No | Absolute-canvas mode only: return ONLY these canvas section ids (use the ids from a previous call's canvas_summary.sections[].id; 'SECTION_POPUP' selects the popups). When a full-page call comes back canvas_summary.truncated:true (styles pruned to fit the size cap), re-call per section to get each section's `source` in FULL untrimmed detail — pairs naturally with building the page incrementally via add_section (pass that call's source.page[0] to add_section). |