Skip to main content

Module doc_adapters

Module doc_adapters 

Source
Expand description

Document adapters: produce SearchDoc chunks from non-code files.

Each adapter takes a file path + raw content and returns Vec<SearchDoc>. Adapters are intentionally thin — no deep structural parsing, just enough text extraction to make files discoverable in asd search.

Supported file types:

  • Markdown (.md, .markdown) — each H1/H2/H3 heading becomes a chunk
  • Config (JSON, TOML, YAML) — key-path flattening for leaf values
  • HTML (.html, .htm) — strip tags, extract title + heading text
  • CSS (.css) — extract selector names and custom property names
  • Manifests (Package.swift, Cargo.toml, pubspec.yaml, package.json) — extract name + description + top-level keys
  • Build scripts (Makefile, Fastfile, Podfile, Gemfile) — extract target/lane names

Functions§

adapt_document
Detect the kind for a file path and, if recognised, parse it into chunks. Returns None when the file is not handled by any adapter.
is_doc_file
Returns true if this path should be offered to document adapters. Used to quickly gate file walking before reading content.