# strangelion/latexsnipper-office architecture

> Architecture diagram of the GitHub repository strangelion/latexsnipper-office, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/strangelion/latexsnipper-office
- Repository: https://github.com/strangelion/latexsnipper-office
- Video tour (about a minute): https://gitdiagram.com/strangelion/latexsnipper-office/video

## Overview

LaTeXSnipper Office is a desktop LaTeX formula editor and insertion tool with companion integrations for Office, Obsidian, WPS, VS Code, and browsers. The main workflow is to create or recognize formula content, preview or export it, then insert it through a host-aware route. Drawing, custom-symbol creation, formula styling, and live Office editing are substantial parallel capabilities. Edges use the sampled source index and excerpts or README statements; several integration internals are unsampled, so their detailed call paths are not inferred.

Main entry points: [`src/main.js`](https://github.com/strangelion/latexsnipper-office/blob/main/src/main.js) (Desktop app), [`apps/native-office/LaTeXSnipper.Shared/OleFormulaInterop.cs`](https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Shared/OleFormulaInterop.cs) (OLE interop), [`src/services/office-insertion-service.js`](https://github.com/strangelion/latexsnipper-office/blob/main/src/services/office-insertion-service.js) (Insertion service), [`src/features/recognition/controller.js`](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/recognition/controller.js) (Recognition workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Desktop workspace"]
  node_desktop["Desktop app<br/>[main.js]"]
  node_library[("Formula library<br/>[preferences.js]")]
  node_style["Formula styling<br/>[controller.js]"]
end

subgraph group_creation["Formula creation"]
  node_formula_editor["Formula editor<br/>[editor.ts]"]
  node_formula_render["Formula rendering<br/>[renderer.rs]"]
  node_drawing["Drawing workspace<br/>[workspace.js]"]
  node_symbols["Custom symbols<br/>[composer.js]"]
end

subgraph group_recognition["Recognition"]
  node_recognition_ui["Recognition workflow<br/>[controller.js]"]
  node_recognition_api["Recognition API<br/>[api.js]"]
  node_recognition_runtime["Recognition runtime<br/>[execution.rs]"]
end

subgraph group_office["Office integration"]
  node_office_insert["Insertion service"]
  node_platform_context["Host capabilities"]
  node_live_edit["Office live edit"]
  node_office_backend["Office coordination<br/>[coordinator.rs]"]
  node_office_bridge["Office bridge<br/>[office_bridge.rs]"]
  node_word_adapter["Word adapter<br/>[WordAdapter.cs]"]
  node_excel_adapter["Excel adapter<br/>[ExcelAdapter.cs]"]
  node_powerpoint_adapter["PowerPoint adapter"]
  node_ole_interop["OLE interop"]
  node_ole_store[("OLE payload store")]
end

subgraph group_ecosystem["Platform plugins"]
  node_browser["Browser extension<br/>[content.ts]"]
  node_browser_settings["Extension settings<br/>[schema.ts]"]
  node_obsidian["Obsidian plugin<br/>[main.ts]"]
  node_vscode["VS Code extension<br/>[extension.ts]"]
  node_wps["WPS add-in<br/>[main.js]"]
  node_officejs["Office web add-in<br/>[taskpane.ts]"]
end

node_user(("User"))
node_office_host["Office host"]

node_user -->|"uses"| node_desktop
node_desktop -->|"loads preferences"| node_library
node_desktop -->|"configures style"| node_style
node_desktop -->|"plans drawing route"| node_drawing
node_desktop -->|"opens composer"| node_symbols
node_desktop -->|"opens recognition"| node_recognition_ui
node_desktop -->|"coordinates live edit"| node_live_edit
node_user -->|"edits formulas"| node_formula_editor
node_formula_editor -.->|"previews formula"| node_formula_render
node_user -->|"creates drawings"| node_drawing
node_user -->|"composes symbols"| node_symbols
node_recognition_ui -->|"requests recognition"| node_recognition_api
node_recognition_api -.->|"runs recognition"| node_recognition_runtime
node_user -->|"submits image"| node_recognition_ui
node_user -->|"requests insertion"| node_office_insert
node_office_insert -->|"resolves capabilities"| node_platform_context
node_office_insert -->|"resolves route"| node_office_backend
node_live_edit -->|"updates draft"| node_office_backend
node_office_backend -.->|"coordinates bridge"| node_office_bridge
node_office_bridge -.->|"bridges host"| node_office_host
node_office_host -->|"uses Word path"| node_word_adapter
node_office_host -->|"uses Excel path"| node_excel_adapter
node_office_host -->|"uses PowerPoint path"| node_powerpoint_adapter
node_word_adapter -->|"uses OLE helpers"| node_ole_interop
node_excel_adapter -->|"uses OLE helpers"| node_ole_interop
node_powerpoint_adapter -->|"uses OLE helpers"| node_ole_interop
node_ole_interop -->|"uses pending payloads"| node_ole_store
node_user -->|"uses extension"| node_browser
node_browser -.->|"reads settings"| node_browser_settings
node_user -->|"uses plugin"| node_obsidian
node_user -->|"uses extension"| node_vscode
node_user -->|"uses add-in"| node_wps
node_user -->|"uses add-in"| node_officejs

click node_desktop "https://github.com/strangelion/latexsnipper-office/blob/main/src/main.js"
click node_library "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/formula-library/preferences.js"
click node_style "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/formula-style/controller.js"
click node_formula_editor "https://github.com/strangelion/latexsnipper-office/blob/main/modules/core/formula-editor/src/editor.ts"
click node_formula_render "https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/engine/renderer.rs"
click node_drawing "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/drawing/workspace.js"
click node_symbols "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/custom-symbols/composer.js"
click node_recognition_ui "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/recognition/controller.js"
click node_recognition_api "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/recognition/api.js"
click node_recognition_runtime "https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/recognition/execution.rs"
click node_office_insert "https://github.com/strangelion/latexsnipper-office/blob/main/src/services/office-insertion-service.js"
click node_platform_context "https://github.com/strangelion/latexsnipper-office/blob/main/src/platform/platform-context.js"
click node_live_edit "https://github.com/strangelion/latexsnipper-office/blob/main/src/features/office-live-edit/office-edit-controller.js"
click node_office_backend "https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/office_integration/coordinator.rs"
click node_office_bridge "https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/platforms/office_bridge.rs"
click node_word_adapter "https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Word/Host/WordAdapter.cs"
click node_excel_adapter "https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Excel/Host/ExcelAdapter.cs"
click node_powerpoint_adapter "https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.PowerPoint/Host/PowerPointAdapter.cs"
click node_ole_interop "https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Shared/OleFormulaInterop.cs"
click node_ole_store "https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Shared/OleFormulaPendingPayloadStore.cs"
click node_browser "https://github.com/strangelion/latexsnipper-office/blob/main/apps/browser-extension/src/content.ts"
click node_browser_settings "https://github.com/strangelion/latexsnipper-office/blob/main/apps/browser-extension/src/settings/schema.ts"
click node_obsidian "https://github.com/strangelion/latexsnipper-office/blob/main/apps/obsidian-plugin/main.ts"
click node_vscode "https://github.com/strangelion/latexsnipper-office/blob/main/apps/vscode-extension/src/extension.ts"
click node_wps "https://github.com/strangelion/latexsnipper-office/blob/main/apps/wps/main.js"
click node_officejs "https://github.com/strangelion/latexsnipper-office/blob/main/apps/office-addin/src/taskpane/taskpane.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_desktop,node_library,node_style,node_user toneBlue
class node_formula_editor,node_formula_render,node_drawing,node_symbols toneAmber
class node_recognition_ui,node_recognition_api,node_recognition_runtime toneMint
class node_office_insert,node_platform_context,node_live_edit,node_office_backend,node_office_bridge,node_word_adapter,node_excel_adapter,node_powerpoint_adapter,node_ole_interop,node_ole_store toneRose
class node_browser,node_browser_settings,node_obsidian,node_vscode,node_wps,node_officejs,node_office_host toneIndigo
```

## Components

### Desktop workspace

- [Desktop app](https://github.com/strangelion/latexsnipper-office/blob/main/src/main.js): `src/main.js`
- [Formula library](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/formula-library/preferences.js): `src/features/formula-library/preferences.js`
- [Formula styling](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/formula-style/controller.js): `src/features/formula-style/controller.js`

### Formula creation

- [Formula editor](https://github.com/strangelion/latexsnipper-office/blob/main/modules/core/formula-editor/src/editor.ts): `modules/core/formula-editor/src/editor.ts`
- [Formula rendering](https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/engine/renderer.rs): `src-tauri/src/engine/renderer.rs`
- [Drawing workspace](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/drawing/workspace.js): `src/features/drawing/workspace.js`
- [Custom symbols](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/custom-symbols/composer.js): `src/features/custom-symbols/composer.js`

### Recognition

- [Recognition workflow](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/recognition/controller.js): `src/features/recognition/controller.js`
- [Recognition API](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/recognition/api.js): `src/features/recognition/api.js`
- [Recognition runtime](https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/recognition/execution.rs): `src-tauri/src/recognition/execution.rs`

### Office integration

- [Insertion service](https://github.com/strangelion/latexsnipper-office/blob/main/src/services/office-insertion-service.js): `src/services/office-insertion-service.js`
- [Host capabilities](https://github.com/strangelion/latexsnipper-office/blob/main/src/platform/platform-context.js): `src/platform/platform-context.js`
- [Office live edit](https://github.com/strangelion/latexsnipper-office/blob/main/src/features/office-live-edit/office-edit-controller.js): `src/features/office-live-edit/office-edit-controller.js`
- [Office coordination](https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/office_integration/coordinator.rs): `src-tauri/src/office_integration/coordinator.rs`
- [Office bridge](https://github.com/strangelion/latexsnipper-office/blob/main/src-tauri/src/platforms/office_bridge.rs): `src-tauri/src/platforms/office_bridge.rs`
- [Word adapter](https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Word/Host/WordAdapter.cs): `apps/native-office/LaTeXSnipper.Word/Host/WordAdapter.cs`
- [Excel adapter](https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Excel/Host/ExcelAdapter.cs): `apps/native-office/LaTeXSnipper.Excel/Host/ExcelAdapter.cs`
- [PowerPoint adapter](https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.PowerPoint/Host/PowerPointAdapter.cs): `apps/native-office/LaTeXSnipper.PowerPoint/Host/PowerPointAdapter.cs`
- [OLE interop](https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Shared/OleFormulaInterop.cs): `apps/native-office/LaTeXSnipper.Shared/OleFormulaInterop.cs`
- [OLE payload store](https://github.com/strangelion/latexsnipper-office/blob/main/apps/native-office/LaTeXSnipper.Shared/OleFormulaPendingPayloadStore.cs): `apps/native-office/LaTeXSnipper.Shared/OleFormulaPendingPayloadStore.cs`

### Platform plugins

- [Browser extension](https://github.com/strangelion/latexsnipper-office/blob/main/apps/browser-extension/src/content.ts): `apps/browser-extension/src/content.ts`
- [Extension settings](https://github.com/strangelion/latexsnipper-office/blob/main/apps/browser-extension/src/settings/schema.ts): `apps/browser-extension/src/settings/schema.ts`
- [Obsidian plugin](https://github.com/strangelion/latexsnipper-office/blob/main/apps/obsidian-plugin/main.ts): `apps/obsidian-plugin/main.ts`
- [VS Code extension](https://github.com/strangelion/latexsnipper-office/blob/main/apps/vscode-extension/src/extension.ts): `apps/vscode-extension/src/extension.ts`
- [WPS add-in](https://github.com/strangelion/latexsnipper-office/blob/main/apps/wps/main.js): `apps/wps/main.js`
- [Office web add-in](https://github.com/strangelion/latexsnipper-office/blob/main/apps/office-addin/src/taskpane/taskpane.ts): `apps/office-addin/src/taskpane/taskpane.ts`

### Other components

- **User**
- **Office host**

## Connections

- User → Desktop app: uses
- Desktop app → Formula library: loads preferences (evidence: `src/main.js`)
- Desktop app → Formula styling: configures style (evidence: `src/main.js`)
- Desktop app → Drawing workspace: plans drawing route (evidence: `src/main.js`)
- Desktop app → Custom symbols: opens composer (evidence: `src/main.js`)
- Desktop app → Recognition workflow: opens recognition (evidence: `src/main.js`)
- Desktop app → Office live edit: coordinates live edit (evidence: `src/main.js`)
- User → Formula editor: edits formulas
- Formula editor → Formula rendering: previews formula
- User → Drawing workspace: creates drawings
- User → Custom symbols: composes symbols
- Recognition workflow → Recognition API: requests recognition (evidence: `src/features/recognition/controller.js`)
- Recognition API → Recognition runtime: runs recognition
- User → Recognition workflow: submits image
- User → Insertion service: requests insertion
- Insertion service → Host capabilities: resolves capabilities (evidence: `src/services/office-insertion-service.js`)
- Insertion service → Office coordination: resolves route (evidence: `src/services/office-insertion-service.js`)
- Office live edit → Office coordination: updates draft (evidence: `src/features/office-live-edit/office-edit-controller.js`)
- Office coordination → Office bridge: coordinates bridge
- Office bridge → Office host: bridges host
- Office host → Word adapter: uses Word path
- Office host → Excel adapter: uses Excel path
- Office host → PowerPoint adapter: uses PowerPoint path
- Word adapter → OLE interop: uses OLE helpers (evidence: `apps/native-office/LaTeXSnipper.Shared/OleFormulaInterop.cs`)
- Excel adapter → OLE interop: uses OLE helpers (evidence: `apps/native-office/LaTeXSnipper.Excel/Host/ExcelAdapter.cs`)
- PowerPoint adapter → OLE interop: uses OLE helpers (evidence: `apps/native-office/LaTeXSnipper.PowerPoint/Host/PowerPointAdapter.cs`)
- OLE interop → OLE payload store: uses pending payloads (evidence: `apps/native-office/LaTeXSnipper.Excel/Host/ExcelAdapter.cs`)
- User → Browser extension: uses extension
- Browser extension → Extension settings: reads settings
- User → Obsidian plugin: uses plugin
- User → VS Code extension: uses extension
- User → WPS add-in: uses add-in
- User → Office web add-in: uses add-in
