How edwardkim/rhwp works
rhwp is a Rust document engine for viewing and editing HWP, HWPX, and supported HML files, exposed through WebAssembly, CLI, desktop, and platform integrations. The main workflow parses a document into a shared model, composes and paginates it, then renders or saves it; Studio adds interactive editing and document commands. The README documents broader format and output capabilities than the sampled source excerpts. Some indexed core paths are absent from the supplied tree, so those paths follow the explicit SOURCE INDEX; unsampled subsystem links are limited to documented relationships.
Main entry points: mod.rs Format parsers · main.ts Web editor · composer.rs Paragraph composition · document.rs Document model
Components 25
Formats and model
- Format parsers
src/parser/mod.rs - Document model
src/model/document.rs - Paragraphs and controls
src/model/paragraph.rs - Shapes and objects
src/model/shape.rs - Tables
src/model/table.rs - Styles
src/model/style.rs - Source fidelity
src/model/provenance.rs
Layout engine
- Document core
src/document_core/mod.rs - Style resolution
src/renderer/style_resolver.rs - Paragraph composition
src/renderer/composer.rs - Pagination
src/renderer/pagination/engine.rs - Floating placement
src/renderer/float_placement.rs - Content measurement
src/renderer/height_measurer.rs
Rendering and output
- Render tree
src/renderer/mod.rs - Render backends
src/render_backend/mod.rs - Document saving
src/serializer/mod.rs
Studio editing
- Web editor
rhwp-studio/src/main.ts - Editor commands
rhwp-studio/src/command/dispatcher.ts - Document agent
rhwp-studio/src/document-agent/controller.ts - Document comparison
rhwp-studio/src/compare/diff-engine.ts
Product interfaces
- WASM API
src/lib.rs - CLI tools
src/main.rs - Browser extensions
rhwp-chrome/background.js - VS Code viewer
rhwp-vscode/src/extension.ts
Other components
- Document user
Connections 32
- Document user → Web editor: opens document
README.md - Document user → CLI tools: requests output
README.md - Format parsers → Document model: builds model
src/parser/mod.rs - Document model → Document core: provides document
src/document_core/mod.rs - Document core → Render tree: builds render tree
src/document_core/mod.rs - Document core → Paragraph composition: uses composition
src/document_core/mod.rs - Document core → Pagination: uses pagination
src/document_core/mod.rs - Style resolution → Styles: resolves styles
src/renderer/style_resolver.rs - Paragraph composition → Paragraphs and controls: composes paragraphs
src/renderer/composer.rs - Paragraph composition → Style resolution: uses resolved styles
src/renderer/composer.rs - Content measurement → Paragraph composition: measures composition
src/renderer/height_measurer.rs - Content measurement → Style resolution: uses resolved styles
src/renderer/height_measurer.rs - Pagination → Content measurement: measures content
src/renderer/pagination/engine.rs - Pagination → Floating placement: places floats
src/renderer/pagination/engine.rs - Render tree → Render backends: renders output
src/render_backend/mod.rs - CLI tools → Format parsers: opens formats
README.md - CLI tools → Render backends: exports pages
README.md - CLI tools → Document saving: saves documents
README.md - Web editor → Editor commands: dispatches commands
- Editor commands → WASM API: edits document
README.md - Web editor → Render tree: shows pages
README.md - Web editor → Document comparison: compares documents
README.md - Web editor → Document agent: supports agent access
rhwp-studio/src/document-agent/controller.ts - Browser extensions → WASM API: views documents
README.md - VS Code viewer → WASM API: views documents
README.md - Format parsers → Paragraphs and controls: populates model
src/parser/mod.rs - Format parsers → Styles: populates styles
src/parser/mod.rs - Format parsers → Source fidelity: preserves provenance
src/parser/mod.rs - Document model → Paragraphs and controls: contains structures
src/model/document.rs - Document model → Shapes and objects: references objects
src/model/document.rs - Paragraphs and controls → Tables: embeds controls
src/model/paragraph.rs - Paragraph composition → Tables: composes cells
src/renderer/composer.rs