| Crates.io | trek-rs |
| lib.rs | trek-rs |
| version | 0.2.1 |
| created_at | 2025-06-19 15:41:09.874765+00 |
| updated_at | 2025-06-28 16:34:02.485476+00 |
| description | A web content extraction library that removes clutter from web pages |
| homepage | |
| repository | https://github.com/officialunofficial/trek |
| max_upload_size | |
| id | 1718503 |
| size | 1,254,013 |

A modern web content extraction library written in Rust, compiled to WebAssembly.
Trek removes clutter from web pages and extracts clean, readable content. It's designed as a modern alternative to Mozilla Readability with enhanced features like mobile-aware extraction and consistent HTML standardization.
[dependencies]
trek-rs = "0.1"
npm install @officialunofficial/trek
Or with other package managers:
# Yarn
yarn add @officialunofficial/trek
# pnpm
pnpm add @officialunofficial/trek
# Bun
bun add @officialunofficial/trek
use trek_rs::{Trek, TrekOptions};
let options = TrekOptions {
debug: false,
url: Some("https://example.com".to_string()),
..Default::default()
};
let trek = Trek::new(options);
let result = trek.parse(html_content)?;
println!("Title: {}", result.metadata.title);
println!("Content: {}", result.content);
Trek includes an interactive web playground for testing content extraction:
# Build WASM and start the playground server
make playground
# Open http://localhost:8000/playground/ in your browser
The playground provides:
import init, { TrekWasm } from '@officialunofficial/trek';
// Initialize the WASM module
await init();
const trek = new TrekWasm({
debug: false,
url: 'https://example.com'
});
const result = await trek.parse(htmlContent);
console.log('Title:', result.title);
console.log('Content:', result.content);
cargo build --release
wasm-pack build --target web --out-dir pkg
# Run tests
cargo test
# Run clippy
cargo clippy --all-targets --all-features
# Format code
cargo fmt
# Generate changelog
git cliff -o CHANGELOG.md
We welcome contributions! Trek uses conventional commits and automated changelog generation.
# Install development dependencies
make install-dev-deps
# Configure git for conventional commits
make setup-git
# Run pre-commit checks
make pre-commit
We follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
Examples:
feat(wasm): add support for custom headersfix(parser): handle empty meta tags correctlydocs: update installation instructionsFor detailed contribution guidelines, see CONTRIBUTING.md.
Trek is a fork of Defuddle by @kepano, refactored into Rust, adding WebAssembly support, site-specific extractors, and additional features.
MIT