Skip to content

Output

Crawled content is saved under the output_base_dir defined in the config, organized by site key and preserving the site structure. Keying by site key (rather than domain) keeps two site configs that target the same domain in separate trees:

<output_base_dir>/
└── <sanitized_site_key>/ # e.g., flask_docs
├── images/ # Always created; only populated when skip_images: false
│ ├── image1.png
│ └── image2.jpg
├── index.md # Markdown for the root path
├── <jsonl_output_filename> # Unless enable_jsonl_output: false
├── llms.txt # Manifest of pages (generated from the JSONL)
├── llms-full.txt # Full content concatenated (generated from the JSONL)
├── topic_one/
│ ├── index.md # From /topic_one/
│ └── subtopic_a.md # From /topic_one/subtopic_a.html
└── topic_two.md # From /topic_two.html (/topic_two gives topic_two/index.md)

A fresh (non---resume) crawl never touches the existing corpus while it runs. It builds into <sanitized_site_key>.staging under output_base_dir and a <sanitized_site_key>_visited_db.staging state directory, and swaps them over the live copies only when the crawl completes. If the crawl is interrupted, cancelled, or fails, the previous output, visited DB, crawl history, and search index stay as they were, and crawl exits 130 on SIGINT/SIGTERM. --resume (and -incremental, which implies it) then continues the staged crawl and swaps it in when done; a new fresh crawl discards leftover staging. Resuming a site with no staging works in place on the live output. Crawl history (get_freshness/diff_crawl) records completed runs only. Staging needs room for a second copy of the site until the swap. A crawl that finishes but loses a large share of its pages is kept back the same way: the previous corpus stays live, the staging is kept, and crawl exits 3 (see CLI for the rules and -allow-shrink). When a fresh crawl is published, a page from the previous corpus that failed with a temporary error keeps its previous copy, with its original crawled_at and content_hash. A completed run that works in place (-incremental, or --resume with no staging) deletes Markdown files no page of the corpus uses any more, such as files under an older file name. It only deletes files that start with doc-scraper’s page front matter (url, crawled_at, content_hash), so other files in the output directory are left alone.

While a site is being crawled, doc-scraper holds a lock on <state_dir>/<sanitized_site_key>.lock, so a second crawl of the site fails instead of overwriting the first one’s files. The lock is released when the crawl ends or its process dies; the file stays and is safe to leave in place. If the state directory’s filesystem doesn’t support file locks (some network mounts), the crawl logs a warning and runs without the lock.

Each page is saved at a path built from its URL path below allowed_path_prefix:

  • A URL whose last segment ends in a page extension (.html, .htm, .xhtml, .shtml, .php, .asp, .aspx, .jsp, .md) is saved as <name>.md. Any other URL becomes a directory holding index.md, so /docs/v1.2 is saved as v1.2/index.md and /docs/guide/ as guide/index.md.
  • A path segment that is already a portable file name is used as it is. One that isn’t (it contains <>:"/\|?*#%, a control or invisible formatting character, ends in a dot or space, is a Windows device name such as CON or com1.txt, or is longer than 100 bytes) is cleaned and gets _ plus 8 hex digits of a hash of the original segment, so different segments don’t share a name.
  • A page whose name would clash with llms.txt, llms-full.txt or the JSONL file in the site root gets a hashed name.
  • Links to files that aren’t pages (.pdf, .zip, images and similar) stay absolute instead of pointing at a Markdown file.
  • URLs that differ only in letter case share a file on case-insensitive filesystems (macOS and Windows by default). When two URLs of a crawl save to the same file, the crawl logs a warning naming both; the JSONL keeps both pages.

When JSONL output is enabled, the crawler also emits llms.txt and llms-full.txt following the llmstxt.org convention. llms.txt is a markdown manifest (H1 + summary blockquote + ## Pages list of every crawled page with title and URL). llms-full.txt concatenates the full markdown content of every page, with section separators. Both files are regenerated on every crawl from the JSONL source of truth, so resumed crawls produce a complete updated manifest.

Each generated Markdown file begins with a YAML frontmatter block carrying page metadata, followed by the converted content:

  • YAML frontmatter (delimited by ---) with title, url (source URL), crawled_at (RFC3339 timestamp), content_hash (SHA-256 of the content, matching the JSONL record), and depth
  • Clean content converted from HTML to GitHub-Flavored Markdown. A table stays a table when each cell fits on one row (a table of a single cell is layout and becomes just its content); line breaks and paragraphs inside a cell become <br>. A table that can’t (for example, a cell holds a list, a multi-line code block, a nested table, or more than four lines) becomes one paragraph per cell, each labeled with its column header (**Name:** value), or with its row header when every row is a header cell and a value. A header row that is one cell spanning every column is a title: it is written once, as **Title**, instead of labeling every cell. Line-numbered code that a highlighter laid out as a table (Pygments and MkDocs Material, Hugo, Jekyll) becomes one code block without the numbers
  • A prepended # <title> heading when the converted body has no H1 heading and the page has a title (for example, when the page’s <h1> sits outside the content selector or readability strips it)
  • Relative links to other crawled pages (within the allowed domain and path prefix); links to pages outside that scope are made absolute
  • Local image references (if images are enabled)

Example:

---
title: 'Authentication'
url: https://docs.example.com/api/auth
crawled_at: "2026-08-09T12:00:00Z"
content_hash: 9f2b...c1a4
depth: 2
---
# Authentication
...page content as Markdown...

The crawler writes one JSON object per line to a JSONL file. This format is designed for ingestion into RAG pipelines and downstream indexers, and it is the stored corpus that search, crawl history, llms.txt, and the MCP page tools read. It is on by default:

enable_jsonl_output: true # default; false disables search and history for the site
jsonl_output_filename: "pages.jsonl" # default

The file mixes two record kinds, distinguished by the record_type field:

  • page records, one per crawled page.
  • A single crawl_meta record as the final line, holding the crawl-level summary. Resuming rewrites the file to drop any leftover crawl_meta record before appending a fresh one at close, so a closed file always contains exactly one crawl_meta record.

page record fields (from PageJSONL):

Field Description
record_type Always "page"
url Final absolute URL of the page
title Page title
content Full markdown content
headings Array of the page’s headings as plain text: ATX and Setext headings and headings inside blockquotes and list items, not # lines inside code blocks
links Array of links found in the content
images Array of image URLs found in the content
content_hash SHA-256 hash of the content (used for incremental crawling)
crawled_at Timestamp of when the page was crawled
depth Crawl depth from the start URL

headings, links, and images are null, not [], when the page has none of that kind: Go encodes a nil slice as JSON null.

A page linked under equivalent forms (/guide/ and /guide/index.html, %41 for A, a trailing empty ?) is crawled once and has one record; its url is the form it was fetched under.

crawl_meta record fields (from CrawlMetaJSONL):

Field Description
record_type Always "crawl_meta"
site_key Site key from the config
allowed_domain The crawled domain
crawl_started_at Crawl start timestamp
crawl_ended_at Crawl end timestamp
total_pages Number of pages recorded in this crawl

The output file is written to each site’s output directory. Both the enable flag and filename can be overridden per site.