How azyarashi/obsidian-typst-mate works
Typst Mate is an Obsidian plugin that turns Typst and math content into rendered previews and exports. The main workflow is editing a math region or code block, applying editor assistance and processor settings, then rendering through a worker-backed Typst/WASM runtime. The README also documents standalone .typ viewing, tools, package/font support, and integrations. Several subsystem paths are known from the tree and README, but their internal wiring was not sampled; those links are omitted where uncertain.
Main entry points: main.ts Plugin lifecycle · worker.ts Render worker · typst.ts Typst manager · index.ts Editor setup
Components 21
Plugin runtime
- Plugin lifecycle
src/main.ts
Editing experience
- Editor setup
src/editor/index.ts - Markdown extensions
src/editor/markdown/build.ts - Inline preview
src/editor/markdown/extensions/InlineMathPreview.ts - Code preview
src/editor/markdown/extensions/CodeBlockPreview.ts - Editor assistance
src/editor/shared/extensions - Typst syntax
packages/typst-syntax/src/typst-syntax
Typst rendering
- Typst manager
src/libs/typst.ts - Render worker
src/libs/worker.ts - Typst WASM
wasm/src/lib.rs - Packages and fonts
src/libs/worker.ts
Views and tools
- Typst preview view
src/ui/views/typst-preview/typstPreview.ts - Typst text view
src/ui/views/typst-text/typstText.ts - Typst tools
src/ui/views/typst-tools/typstTools.ts - PDF export
src/utils/export.ts
Configuration and integrations
- Processor settings
src/libs/processor.ts - Plugin settings UI
src/ui/settingsTab - Excalidraw plugin
src/plugins/excalidraw.ts
Other components
- Obsidian user
- Obsidian host
- Release and package network
Connections 22
- Obsidian user → Obsidian host: uses
- Obsidian host → Plugin lifecycle: loads plugin
- Plugin lifecycle → Editor setup: sets up
- Editor setup → Markdown extensions: builds extensions
- Markdown extensions → Inline preview: includes
- Markdown extensions → Code preview: includes
- Editor setup → Editor assistance: registers extensions
- Code preview → Typst manager: requests render
- Plugin lifecycle → Typst manager: prepares runtime
- Plugin lifecycle → Render worker: initializes worker
- Render worker → Typst WASM: calls compiler
- Render worker → Packages and fonts: reads and writes
- Plugin lifecycle → Release and package network: downloads WASM
- Render worker → Release and package network: fetches packages
- Typst preview view → Typst manager: requests page render
- Obsidian user → Typst preview view: opens .typ view
- Obsidian user → Typst tools: opens tools
- Obsidian user → PDF export: requests export
- Plugin settings UI → Plugin lifecycle: configures plugin
- Obsidian user → Excalidraw plugin: uses integration
- Excalidraw plugin → Plugin lifecycle: invokes integration
- Processor settings → Typst manager: configures rendering