infrastructure tier

infrastructure-html-text

Pure, sync HTML->text extraction mechanism: charset-aware decode (encoding_rs; declared charset -> <meta charset> sniff -> windows-1252 fallback, flags recorded), bounded-output structural extraction via lol_html (drops script/style/nav/svg/noscript/template/iframe + comments, outline-stack heading_path with skipped-level retention, output byte cap + per-heading char cap with per-class truncation flags), and section-aware chunking over infrastructure-embeddings::chunk_text with document-absolute char offsets taken from the chunker's returned spans. No I/O, no async, no lossy silent fallback -- the reusable extraction mechanism composed by infrastructure-web-ingest.

Pure, sync HTML->text extraction mechanism: charset-aware decode (encoding_rs; declared charset -> <meta charset> sniff -> windows-1252 fallback, flags recorded), bounded-output structural extraction via lol_html (drops script/style/nav/svg/noscript/template/iframe + comments, outline-stack heading_path with skipped-level retention, output byte cap + per-heading char cap with per-class truncation flags), and section-aware chunking over infrastructure-embeddings::chunk_text with document-absolute char offsets taken from the chunker's returned spans. No I/O, no async, no lossy silent fallback -- the reusable extraction mechanism composed by infrastructure-web-ingest.

Tierinfrastructure
Roleunclassified (baselined)
Pathcrates/infrastructure/html-text
Edition2021
Targetsinfrastructure_html_text
Public items10 across 3 modules
Tests43

What it is for

infrastructure-html-text -- pure, synchronous HTML -> text extraction.

No I/O, no async, no network: bytes and config in, structured text out. Three stages, each independently testable and each mirroring an existing in-repo convention rather than inventing a new one:

1. decode -- bytes -> String via encoding_rs: declared charset -> <meta charset> sniff -> windows-1252 fallback, with a decode::DecodeReport so a lossy decode is never silent. 2. extract -- bounded-output HTML -> text via lol_html (the same streaming rewriter infrastructure-dom-reduce uses): drops script/style/nav/svg/noscript/template/iframe subtrees and comments, builds an outline-stack heading_path from h1-h6, and caps both total output and any single heading's length. 3. chunker -- section-aware chunking over infrastructure_embeddings::chunk_text, the same chunker tools-org-knowledge's markdown pipeline uses, with document-absolute char offsets read directly from the chunker's returned spans.

The reusable mechanism consumed by infrastructure-web-ingest, which adds fetch, storage, and the knowledge-index write.

Capabilities

ChunkInput

Section-aware chunking over infrastructure_embeddings::chunk_text.

Item
pub struct ChunkInput
fn chunk_sections(sections : & Section, opts : & ChunkOptions) -> Vec <ChunkInput>

DecodeReport

bytes -> String decode: declared charset -> <meta charset> sniff ->

Item
pub struct DecodeReport
fn decode(bytes : & u8, declared_charset : Option <& str>) ->(String, DecodeReport)

extract (other)

Bounded-output HTML -> text extraction via lol_html.

Item
fn extract(html : & str, cfg : & ExtractConfig) -> Extraction

ExtractConfig

Bounded-output HTML -> text extraction via lol_html.

Item
pub struct ExtractConfig
ExtractConfig :: fn default() -> Self

Extraction

Bounded-output HTML -> text extraction via lol_html.

Item
pub struct Extraction

Section

Bounded-output HTML -> text extraction via lol_html.

Item
pub struct Section

TruncationFlags

Bounded-output HTML -> text extraction via lol_html.

Item
pub struct TruncationFlags

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

infrastructure_html_text

flowchart TD
  n_infrastructure_html_text["infrastructure_html_text"]
  n_infrastructure_html_text --> n_chunker["chunker"]
  n_infrastructure_html_text --> n_decode["decode"]
  n_infrastructure_html_text --> n_extract["extract"]

Public surface

`chunker`

ItemWhat it is
pub struct ChunkInputOne embeddable chunk with document-absolute (concatenated-sections) char provenance
fn chunk_sections(sections : & Section, opts : & ChunkOptions) -> Vec <ChunkInput>Chunk every section, in order

`decode`

ItemWhat it is
pub struct DecodeReportWhat decode did: which encoding won and whether any byte was unmappable.
fn decode(bytes : & u8, declared_charset : Option <& str>) ->(String, DecodeReport)Decode bytes to a String, honoring declared_charset (typically the charset parameter of an HTTP Content-Type header) first, then sniffing a <meta charset>/<meta http-equiv> declaration in the first META_SNIFF_WINDOW bytes, then falling back to windows-1252 (the pragmatic default browsers use for undeclared legacy content)

`extract`

ItemWhat it is
pub struct ExtractConfigExtraction tuning.
ExtractConfig :: fn default() -> Self
pub struct SectionA contiguous run of extracted text under one heading trail
pub struct TruncationFlagsWhich caps fired
pub struct ExtractionThe result of one extraction pass.
fn extract(html : & str, cfg : & ExtractConfig) -> ExtractionExtract text + heading outline from html

Re-exports. Exported here, defined elsewhere.

ExportDefined in
{chunk_sections,ChunkInput}chunker::{chunk_sections,ChunkInput}
{decode,DecodeReport}decode::{decode,DecodeReport}
{extract,ExtractConfig,Extraction,Section,TruncationFlags}extract::{extract,ExtractConfig,Extraction,Section,TruncationFlags}

Boundary

Depends on no other workspace tier.

Shares tier infrastructure with 82 other crates: infrastructure-acquire, infrastructure-adapters-google-calendar, infrastructure-adapters-google-gmail, infrastructure-adapters-google-places, infrastructure-adapters-google-trends, infrastructure-adapters-shodan, infrastructure-adapters-yelp, infrastructure-agent, … (82 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)infrastructure
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/infrastructure/html-text
Vocabulary in force (lexicon)current

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`infrastructure-embeddings`infrastructurenoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
encoding_rs^0.8noalways
lol_html^3.0.1noalways
serde^1derive, derivenoalways

Development. None.

Build. None.

Depended on by. 4 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_party_discovery["application-party-discovery"] -->|uses| SELF
  n_infrastructure_acquire["infrastructure-acquire"] -->|uses| SELF
  n_infrastructure_web_contact_extractor["infrastructure-web-contact-extractor"] -->|uses| SELF
  n_infrastructure_web_ingest["infrastructure-web-ingest"] -->|uses| SELF
  SELF["infrastructure-html-text"]
  SELF -->|runtime| n_infrastructure_embeddings["infrastructure-embeddings"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libinfrastructure_html_text`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

4 workspace crates depend on this one: application-party-discovery, infrastructure-acquire, infrastructure-web-contact-extractor, infrastructure-web-ingest.

Verification

KindCount
Unit tests43
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
chunker202
decode203
extract5011

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc910
Public modules with a //! block33
pie showData
    title Public items with rustdoc
    "Documented" : 9
    "No rustdoc detected" : 1

Metrics

MetricValue
Rust source files4
Source lines1136
Code lines779
Public API items10
Public modules3
Tests43
Examples0
Cargo features0
Direct runtime dependencies4
Workspace reverse dependencies4
pie showData
    title Public API by kind
    "function" : 3
    "method" : 1
    "struct" : 6
pie showData
    title Rust source composition
    "Code" : 779
    "Blank or comment" : 357

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All infrastructure · Manual