Trek

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.
Features
- 🦀 Written in Rust for performance and safety
- 🌐 Compiles to WebAssembly for browser usage
- 📱 Mobile-aware content extraction
- 🎯 Site-specific extractors for popular platforms
- 🔧 Configurable extraction options
- 📊 Content scoring algorithm
- 🏷️ Metadata extraction (title, author, date, etc.)
Installation
As a Rust library
[]
= "0.1"
As a WASM/JavaScript module
Or with other package managers:
# Yarn
# pnpm
# Bun
Usage
Rust
use ;
let options = TrekOptions ;
let trek = new;
let result = trek.parse?;
println!;
println!;
Web Playground
Trek includes an interactive web playground for testing content extraction:
# Build WASM and start the playground server
# Open http://localhost:8000/playground/ in your browser
The playground provides:
- Live Extraction: Paste HTML and see extracted content instantly
- Multiple Views: Switch between content, metadata, raw JSON, and debug tabs
- Extraction Options: Toggle clutter removal and metadata inclusion
- Example Content: Pre-loaded example to demonstrate Trek's capabilities
Playground Features
- Content Tab: Shows the extracted article content with proper formatting
- Metadata Tab: Displays title, author, word count, and other metadata
- Raw JSON Tab: View the complete extraction response
- Debug Tab: See extraction details and performance metrics
JavaScript/TypeScript
import init from '@officialunofficial/trek';
// Initialize the WASM module
await ;
const trek = ;
const result = await trek.;
console.log;
console.log;
Building
Native library
WebAssembly
Development
# Run tests
# Run clippy
# Format code
# Generate changelog
Contributing
We welcome contributions! Trek uses conventional commits and automated changelog generation.
Quick Start
# Install development dependencies
# Configure git for conventional commits
# Run pre-commit checks
Commit Message Format
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 instructions
For detailed contribution guidelines, see CONTRIBUTING.md.
Credits
Trek is a fork of Defuddle by @kepano, refactored into Rust, adding WebAssembly support, site-specific extractors, and additional features.
License
MIT