Extraction recipe

Technical Documentation

Documentation title, breadcrumb trail, section, fenced code snippets with language tags, heading outline and canonical link.

id: tech-docs mode: static */docs/**/docs*/documentation/**/reference/*re:^https?://[^/]+/docs(/|$)

Field extractors

Each field names the extractor that produces it and the target it reads from.

Field Extractor Target Transforms Required
title css h1 — required
section css nav[aria-label="breadcrumb"] li:last-child — required
breadcrumb css nav[aria-label="breadcrumb"] li — required
codeBlocks css pre code — required
headings css article h1, article h2, article h3 — required
canonicalUrl css link[rel="canonical"] — required

Zod rules

The output schema is projected to JSON Schema to build this table, so the documentation always matches the runtime validation.

Field Type Constraints Required
title string string, min length 1 yes
section string | null string, nullable yes
breadcrumb array array, items: string yes
codeBlocks array array, items: object yes
headings array array, items: object yes
canonicalUrl string | null string, nullable yes

JSON output

The real record produced by the real engine for the sample document of this recipe. The Zod schema accepted it.

{
  "title": "Getting started",
  "section": "Getting started",
  "breadcrumb": [
    "Guides",
    "Getting started"
  ],
  "codeBlocks": [
    {
      "language": "bash",
      "code": "npm install crawlforge\ncrawlforge --help"
    },
    {
      "language": "bash",
      "code": "crawlforge fetch https://example.com/docs --mode static --json"
    }
  ],
  "headings": [
    {
      "level": 1,
      "text": "Getting started"
    },
    {
      "level": 2,
      "text": "Install"
    },
    {
      "level": 2,
      "text": "Fetch your first page"
    },
    {
      "level": 3,
      "text": "Read the Clean Markdown"
    }
  ],
  "canonicalUrl": "https://crawl.cesarcai.dev/docs/getting-started"
}

CLI invocation

crawlforge fetch https://crawl.cesarcai.dev/docs/getting-started --recipe tech-docs --json

Add --db to store the Snapshot, then use crawlforge diff to compare two revisions of the same page.