How strangelion/latexsnipper-core works
LaTeXSnipper Core is a Rust document-understanding platform centered on a shared editable Document AST. Its principal workflow accepts files or pixels, decodes/imports them, runs model-driven OCR and document-structure recognition, resolves regions and reading order, then converts or exports the AST. The repository also exposes native/WASM and application adapters, model/runtime management, plugins, and drawing contracts. Connections below follow README architecture/capability statements and shown source references; unsampled internals are represented at their exact crate paths, with no guessed implementation-level links.
Main entry points: engine.rs Engine service · document.rs Document AST · graph.rs Recognition pipeline · main.rs CLI
Components 26
User interfaces
- CLI
crates/cli/src/main.rs - Rust SDK
crates/engine/src/sdk.rs - Native adapters
crates/ffi/src/application_c.rs - Local worker
crates/worker/src/lib.rs - WASM API
crates/wasm/src/api.rs - Browser client
crates/wasm/js/src/client.ts
Document processing
- Engine service
crates/engine/src/engine.rs - Image and PDF input
crates/image/src/decode.rs - Format import
crates/conversion/src/importer.rs - Recognition pipeline
crates/pipeline/src/graph.rs - OCR inference
crates/inference/src/formula_recognizer.rs - Document AST
crates/ast/src/document.rs
Models and runtimes
- Model registry
crates/model/src/manager.rs - Runtime selection
crates/runtime/src/factory.rs - Native backends
crates/runtime-executorch/src/session.rs - Tract WASM
crates/tract/src/session.rs
Conversion and output
- Format conversion
crates/conversion/src/converter.rs - Syntax formats
crates/syntax/src/parser.rs - Export service
crates/export/src/service.rs - Render tree
crates/export/src/render_tree.rs - Output generators
crates/export/src/generator.rs - Drawing contracts
crates/drawing/src/adapter.rs
Extensions
- Plugin host
crates/plugin/src/registry_manager.rs - WASI host
crates/plugin-wasi/src/host.rs - Runtime plugin ABI
crates/runtime-plugin-api/src/host.rs
Other components
- Applications
Connections 34
- Applications → CLI: invokes
README.md - Applications → Rust SDK: uses
README.md - Applications → Native adapters: uses
README.md - Applications → Local worker: requests
README.md - Applications → Browser client: uses
README.md - CLI → Format import: imports
crates/cli/src/main.rs - Rust SDK → Engine service: calls
- Native adapters → Engine service: adapts
README.md - Local worker → Engine service: serves
README.md - WASM API → Engine service: exposes
- Browser client → WASM API: requests
- Engine service → Image and PDF input: processes
README.md - Engine service → Format import: dispatches
README.md - Engine service → Recognition pipeline: runs
README.md - Image and PDF input → Recognition pipeline: supplies pixels
README.md - Format import → Document AST: builds
README.md - Recognition pipeline → OCR inference: dispatches
README.md - Recognition pipeline → Document AST: produces
README.md - Engine service → Model registry: resolves models
crates/engine/src/engine.rs - Engine service → Runtime selection: selects runtime
README.md - Runtime selection → Native backends: uses providers
- Recognition pipeline → Tract WASM: runs in browser
README.md - CLI → Format conversion: converts
crates/cli/src/main.rs - Format conversion → Document AST: reads and writes
README.md - Syntax formats → Document AST: parses formats
- CLI → Export service: exports
crates/cli/src/main.rs - Export service → Render tree: builds
crates/export/src/service.rs - Export service → Output generators: dispatches
crates/export/src/service.rs - Render tree → Output generators: feeds
crates/export/src/generator.rs - Export service → Document AST: reads
crates/export/src/service.rs - Drawing contracts → Document AST: adapts
README.md - Engine service → Plugin host: supports hooks
- Plugin host → WASI host: activates components
README.md - Runtime selection → Runtime plugin ABI: loads extensions
README.md