Skip to main content

Crate lectito

Crate lectito 

Source
Expand description

Extract readable article content from HTML.

The crate does not fetch pages. Pass HTML from a crawler, browser, cache, or fixture, plus an optional base URL for resolving relative links.

Use extract for normal application code. Use extract_with_diagnostics when debugging root selection, cleanup, or site profiles.

use lectito::{extract, ReadabilityOptions};

let options = ReadabilityOptions::default();
let article = extract(html, Some("https://example.com/post"), &options)?;
if let Some(article) = article {
    println!("{}", article.text_content);
}

Structs§

Article
Extracted article content and metadata.
AttemptDiagnostic
Diagnostics for one generic extraction attempt.
CandidateDiagnostic
Diagnostics for one candidate article root.
CleanupDiagnostic
Cleanup measurements for a selected article root.
ContentSelectorDiagnostic
Diagnostics for a caller-provided content selector.
ExtractionDiagnostics
Details about how extraction selected, cleaned, and accepted article roots.
ExtractionReport
Article output plus diagnostics for the decisions made during extraction.
FlagDiagnostic
Generic extraction flags used for an attempt.
MarkdownOptions
Options for Markdown-to-HTML rendering.
NodeDiagnostic
Stable summary of a DOM node used in diagnostics.
ReadabilityOptions
Options for full article extraction.
ReadableOptions
Options for the quick readability check.
RecoveryDiagnostic
Content recovery performed before scoring.
RuleSource
Provenance for a built-in trope rule.
TextRange
Location of a match in the original input.
TropeFinding
One trope finding in the input text.
TropeOptions
Options for trope diagnostics.
TropeReport
Complete trope diagnostics report.
TropeSummary
Aggregate report measurements.

Enums§

CandidateSelection
Reason a node was considered as an article root.
Error
Error returned by Lectito extraction and conversion functions.
ExtractionOutcome
Final status for an extraction report.
MediaRetention
Controls how much media remains in extracted article HTML and Markdown.
Severity
Severity of one finding.
TropeCategory
Broad category for a trope rule or detector.
TropePreset
Built-in scanning preset.
TropeSignal
Coarse trope signal for a report.

Functions§

analyze_tropes
Analyze text for AI-like writing tropes.
clean_article_html
Extract and return only the cleaned article HTML.
escape_html
Escapes text for safe insertion into HTML text or attribute contexts.
extract
Extract a readable article from an HTML document.
extract_with_diagnostics
Extract an article and include diagnostics for root selection and cleanup.
html_to_markdown
Convert a cleaned HTML fragment to Markdown.
is_probably_readable
Return a quick estimate of whether an HTML document contains article text.
markdown_to_html
Render Markdown to HTML with the provided options.
markdown_with_toml_frontmatter
Format an article as Markdown with TOML frontmatter.

Type Aliases§

Result
Result type used by Lectito APIs.