Skip to main content

Markdownee npm CLI

Use the CLI for a single page or a stored crawl. For programmatic access from Node.js, see the npm library.

Install

npm install markdownee
npx playwright install chromium

Use Node.js 22.22.2+ on the 22 line, 24.15.0+ on the 24 line, or 26+. Install Chromium for adaptive or Chromium crawling, or run npx playwright install firefox for the Firefox crawler. Cheerio needs no browser binary.

Start with storage or direct output

This sequence collects a page, then exports its stored formats and a manifest.json index:

npx markdownee crawl https://en.wikipedia.org/wiki/Web_scraping
npx markdownee export

For a single URL, crawl-one writes directly to stdout or files without opening Crawlee storage:

npx markdownee crawl-one https://en.wikipedia.org/wiki/Web_scraping | less

The reference examples invoke markdownee directly. With a local package installation, prefix them with npx; a global installation through npm install -g markdownee exposes the command directly.

Crawl into storage

markdownee crawl [URLS...]

crawl accepts starting URLs and stores success and failure records. Enable --store-skipped-urls to include skips. A request still failing after retries makes the command exit with code 2 while retaining successful records.

markdownee crawl https://example.com \
  --mode precision --save minified-html-kvs
markdownee crawl https://a.com https://b.com --save txt-kvs
markdownee crawl --start-urls-file urls.txt --storage ./my-archive

Crawl one page

markdownee crawl-one <url>

The default route is markdown-stdout. Diagnostics use stderr. File routes write directly to the chosen path; this command follows no links and creates no Dataset or KVS.

markdownee crawl-one https://example.com/ | less
markdownee crawl-one https://example.com/ --save txt-stdout > body.txt

# → report.md
markdownee crawl-one https://example.com/ \
  --save markdown-file -o report

# → out/page.md + out/page.min.html
markdownee crawl-one https://example.com/ \
  --save markdown-file --save minified-html-file -o out/page

Repeat --save for txt, markdown, html, minified-html, or original with a file or stdout destination. At most one format can use stdout.

-o, --output accepts a literal filename for one output, a base prefix for several, or a directory for URL-derived names. A trailing slash or an existing directory selects directory behavior.

Single-page controls include --crawler-type, --proxy, --mode, --wait-for-selector, and --cookies. Crawl/storage controls such as --globs, --max-crawl-depth, --storage, and --session-pool-name belong to crawl. Exit codes are 0 for success, 1 for a hard failure, and 2 when a requested format has no content.

Export saved results

markdownee export

export reads successful records and writes available formats from inline content or KVS references. Filenames derive from title, URL, then page. Its manifest includes success, failed, and skipped records.

markdownee export                 # → ./markdownee-output
markdownee export --output-dir ./out --storage ./my-archive

Delete local storage

markdownee purge

purge removes the selected storage directory's datasets/, key_value_stores/, and request_queues/ buckets. crawl --purge performs the same cleanup before crawling. Deletion is permanent and has no confirmation prompt.

markdownee purge                          # purge the resolved storage dir
markdownee purge --storage ./my-archive   # purge a specific storage dir

Command reference

Storage

OptionDescription
--storage <path>Storage directory holding the datasets/key_value_stores/request_queues (default: ./storage or the XDG data dir). One --storage path fully identifies a run's storage
--purgePurge the storage at --storage before extracting (datasets, KVS, request queues)
--start-urls-file <path>Read start URLs (one per line) from a file
--config-file, -c <path>Path to JSON config file

For export, use --output-dir <path> (default ./markdownee-output) and --storage <path>.

Crawl settings

OptionDescription
--crawler-type <type>Crawler engine: adaptive (default), firefox, chromium, cheerio
--rendering-type-detection <ratio>Rendering type detection ratio 0–1 (adaptive only, e.g. 0.1)
--markdown-discovery <mode>Use a Markdown representation the site publishes instead of extracting from its HTML: off (default), alternate, negotiate, or probe
--max-requests-per-crawl <n>Max requests to handle (0 = unlimited)
--max-crawl-depth <n>Max link depth from start URLs (0 = unlimited)
--max-results <n>Max results per crawl (0 = unlimited)
--initial-concurrency <n>Initial parallel requests (0 = Crawlee default)
--max-concurrency <n>Max parallel requests (default: 3)
--max-retries <n>Max request retries (default: 3)

Markdown discovery supplies an alternate content source for all formats. The modes are cumulative: follow advertised same-origin links, also negotiate through Accept, then also try a .md sibling. Up to three alternates, a negotiated refetch, and a sibling can be attempted; robots.txt lookup can add an origin-level request. Crawler-path capabilities and per-origin budgets restrict these attempts. Rejected representations fall back to HTML. A Markdown-sourced record carries markdownSource; links come from available page HTML, which is absent when the page response itself is Markdown.

Crawl filtering

OptionDescription
--globs <pattern>Glob pattern to include (repeatable)
--exclude <pattern>Glob pattern to exclude (repeatable)
--selector <css>CSS selector for links to follow
--keep-url-fragmentPreserve URL fragments
--use-sitemapsDiscover and enqueue URLs from sitemap.xml at each start URL domain root
--respect-robots-txtHonor robots.txt
--deduplication <level>Deduplication level: minimal, standard (default), or aggressive

Browser

OptionDescription
--headless / --no-headlessBrowser headless mode (default: headless)
--wait-until <event>Page load event: load, domcontentloaded, networkidle, commit
--navigation-timeout <secs>Navigation timeout in seconds (default: 60)
--wait-for-dynamic-content <secs>Maximum seconds to wait for dynamic content after navigation; the crawler continues as soon as the network is idle or this timeout elapses, whichever comes first (0 = disabled)
--wait-for-selector <css>CSS selector to wait for before extracting (fails on timeout)
--soft-wait-for-selector <css>CSS selector to wait for before extracting (continues on timeout)
--block-media / --no-block-mediaBlock images, stylesheets, fonts, PDFs, and ZIPs (Chromium only; default: on)
--ignore-cors-and-cspDisable CORS/CSP restrictions
--ignore-https-errorsSkip SSL certificate verification
--close-cookie-modals / --no-close-cookie-modalsAttempt to handle cookie-consent interruptions (default: on)
--max-scroll-height <px>Max scroll height in pixels (default: 5000; 0 = disabled)
--user-agent <ua>Custom User-Agent string

Proxy & sessions

OptionDescription
--proxy <url>Proxy URL (repeatable)
--proxy-rotation <strategy>Rotation: recommended, per-request, until-failure
--session-pool-name <name>Named session pool for cross-run session sharing
--max-session-rotations <n>Max session rotations per request on block detection (default: 10)

Cookies & headers

OptionDescription
--cookies <json>JSON array of cookie objects
--headers <json>JSON object of custom HTTP headers

Output & extraction

OptionDescription
--save <token>Format-destination token, repeatable: {txt,markdown,html,minified-html,original}-{dataset,kvs} (default markdown-kvs). List a format twice to save it to both destinations. Saving either generated HTML variant or original to the dataset risks OOM on large pages
--mode <mode>Extraction mode: precision (less noise), balanced (default), recall (more content), keep (no boilerplate removal, clean HTML only)
--language <lang>Filter by declared language (e.g. en); this is not statistical detection
--image-handling <mode>Image handling: exclude (default), alt-text, resolved-url, or save. Multi-page crawl stores saved bytes in its key-value store. crawl-one writes them directly to a sibling <output-stem>.assets/ directory and accepts save only when every route is a file and Markdown, readable HTML, or Minified HTML is selected
--max-image-edge <px>Long-edge pixel cap for images stored by the save image-handling mode (default: 1568; never upscales; 0 = uncapped; ignored outside save mode)
--rasterize-svg / --no-rasterize-svgStore SVGs rasterized to PNG (default) or as sanitized SVG source, in the save image-handling mode (ignored outside save mode)
--link-handling <mode>Link handling: include (default, inline links) or exclude (keep the anchor text, drop the URL)
--table-handling <mode>Table handling: include (default) or exclude (drop table subtrees, including cell text)
--comment-handling <mode>User-comment section handling (forum/blog comments, not <!-- --> markup): include (default) or exclude detected comment containers
--output-layout <layout>Output envelope: minimal (default), standard, or enhanced
--store-skipped-urlsPush skipped URL records to the dataset after crawl
--verbose, -vEnable verbose logging

Combine presentations and image files

Readable and compact HTML are independently selectable:

# Readable generated HTML
markdownee crawl-one https://example.com --save html-stdout

# Compact HTML and Markdown from one extraction
markdownee crawl-one https://example.com \
  --save minified-html-file --save markdown-stdout -o out/page

# Both generated HTML presentations
markdownee crawl-one https://example.com \
  --save html-file --save minified-html-stdout -o out/page

For local images, route all output to files and select at least one derived Markdown or HTML format:

markdownee crawl-one https://example.com \
  --image-handling save \
  --save markdown-file --save html-file --save minified-html-file \
  -o out/page
# out/page.md, out/page.html, and out/page.min.html
# out/page.assets/ when the page has images that survive extraction

Image save mode writes one shared <output-stem>.assets/ directory when images survive extraction and are saved. Derived formats use relative POSIX references; the captured original is not rewritten. Stdout and text/original-only selections reject image save mode before fetching.

Load JSON configuration

Use --config-file for a JSON object with the CLI's camelCase input keys. Common extraction settings match the Actor input; platform-only controls are excluded. Storage and purge orchestration remain on the command line. Ordinary proxies can be supplied as proxyConfiguration: { "proxyUrls": [...] } in JSON or through repeated --proxy flags.

markdownee crawl --config-file config.json --max-requests-per-crawl 10
{
  "startUrls": [{ "url": "https://example.com" }],
  "headless": false,
  "maxRequestsPerCrawl": 10,
  "mode": "recall",
  "imageHandling": "resolved-url",
  "linkHandling": "include",
  "outputLayout": "standard",
  "save": ["txt-dataset"]
}

Schema defaults are applied first, JSON values next, and explicitly supplied CLI arguments last. Explicit --proxy flags replace configured proxy URLs. Unknown keys and Actor-only fields such as datasetName, keyValueStoreName, and requestQueueName fail validation; --storage selects the default local buckets. Apify Proxy controls such as useApifyProxy and groups are rejected, including when ordinary proxy URLs are also present.

Resolve the storage path

The first available value wins:

  • --storage
  • MARKDOWNEE_STORAGE_DIR
  • CRAWLEE_STORAGE_DIR
  • ./storage when .actor/ or ./storage/ exists in the working directory
  • ${XDG_DATA_HOME:-~/.local/share}/markdownee/storage

Related guides

Updated: September 10, 2026