Skip to content
Webfold Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Architecture

How conversion, acquisition and execution fit together.

Webfold has distinct conversion, acquisition and execution paths. Local HTML conversion needs no browser process.

Conversion

HTML string -> to_blocks -> Markdown blocks -> Template page counts
                                    \                    |
                                     +---- render <------+  -> Markdown string

to_blocks scans UTF-8 input into blocks (md, a 64-bit sig, and links). norm_sig normalises whitespace and case before a non-cryptographic 64-bit fold. Template::fold counts each signature at most once per page. render walks blocks in source order and omits those whose frequency meets the threshold.

Tables are accumulated as a single block. Rectangular output, including generated header and separator cells, is allowed only when its cell slots fit a bound relative to the source cells and maximum width. Otherwise source rows become unpadded pipe lines.

Acquisition

Webfold::scrape calls a FetchBackend. scrape_tiered adds three acquisition actions under a budget. scrape --render connects to a Chromium you run and observes computed CSS visibility and same-origin frames, behind a validating proxy. See Scraping and Rendered pages.

Execution

  • An in-process DOM and JavaScript engine lifts and runs a supported script fragment. It is not V8.
  • A CDP subset server exposes that engine over WebSockets. Every method is implemented, a named no-op, or unsupported.
  • Screenshots use Webfold’s own layout and paint pipeline rather than Chrome’s.

Layers

Layer Responsibility
L0 Block signature hashing, template frequency counting, string extraction.
L1 DOM arena, tag tokenizer, CSS cascade, structural fingerprints.
L2 Execution runtime, sandboxing, origin-isolated contexts, stealth patches.
L3 Crawl frontier, MCP and CDP servers, SERP parsing, compliance checks.
L4 CLI binary and test suites.

The full description, including known limits of each path, is in ARCHITECTURE.md and docs/EXTRACTION-PIPELINE.md in the repository.