Skip to main content

Trafilatura Core npm CLI

Use Node.js 22.22.2+ on 22.x, 24.15.0+ on 24.x, or 26+. This command needs no global installation:

printf '%s\n' '<nav>Home</nav><p>Saved article text.</p>' |
  npx --package=@markdownee/trafilaturacore trafilaturacore \
    --boilerplate keep --output cleaned.html

It writes <p>Saved article text.</p> to cleaned.html. Keep skips main-content extraction but still applies cleanup. For repeated use, install locally:

npm init -y
npm install @markdownee/trafilaturacore
npx trafilaturacore --help

Files and output

Save your source HTML as article.html, then run:

npx trafilaturacore article.html --output cleaned.html

Omit the input path, or use -, for stdin. Omit --output for stdout. Diagnostics go to stderr; --json writes the result envelope containing HTML, messages, and available metadata. Invalid options, configuration, or input paths exit nonzero.

Options

FlagPurpose
-b, --boilerplateprecision, balanced (default), recall, or keep
--image-handlinginclude (default), exclude, alt-text, or resolved-url
--link-handling, --table-handling, --comment-handlinginclude (default) or exclude
-u, --urlSource URL for metadata and relative images; never fetched
-o, --outputDestination file
--jsonResult envelope instead of HTML alone
-q, --quietSuppress stderr diagnostics
-c, --configJSON CleanConfig file replacing the default cleaning config

See the content controls for removal behavior and the library reference for CleanConfig. Configuration files are JSON only. Scripts, event handlers, and dangerous URLs remain subject to filtering with custom policies.

For JavaScript or TypeScript integration, use the npm library.

Updated: September 25, 2026