# zsviczian/obsidian-excalidraw-plugin architecture

> Architecture diagram of the GitHub repository zsviczian/obsidian-excalidraw-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zsviczian/obsidian-excalidraw-plugin
- Repository: https://github.com/zsviczian/obsidian-excalidraw-plugin

## Overview

##### Main Components

a) Core Components:
- Editor System (src/core/editor)
- View System (src/view)
- Managers Layer (src/core/managers)
- Settings System (src/core/settings)
- Language/Localization System (src/lang)
- Shared Utilities (src/shared)

b) Integration Points:
- Obsidian API Integration
- File System Integration
- External Services (OCR, LaTeX, etc.)
- Script Engine
- Event System

##### Key Relationships to Highlight

- UI Components ↔ Core Services
- Core Services ↔ Storage & Integration
- EventManager ↔ All Components (event bus pattern)

##### Specific Implementation Details

- Script Engine Store
- MathjaxToSVG Converter
- SVG to Excalidraw Converter
- Markdown Processor
- Image Handler
- OCR Service

##### Data Flow Indicators

- User input flow
- File save/load operations
- Event propagation
- Script execution flow
- Export/Import operations

##### Additional Elements

Include:
- Version information
- External dependencies
- Configuration points
- Extension points for scripts

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        EV[ExcalidrawView]:::ui
        DG[Dialogs]:::ui
        MN[Menus]:::ui
        TP[Tool Panels]:::ui
    end

    subgraph CS["Core Services Layer"]
        direction TB
        CM[Command Manager]:::core
        EM[Event Manager]:::core
        FM[File Manager]:::core
        PM[Package Manager]:::core
        SM[Styles Manager]:::core
        OM[Observer Manager]:::core
    end

    subgraph ES["Editor & Settings"]
        direction TB
        ED[Editor System]:::editor
        ST[Settings System]:::settings
        LS[Language System]:::settings
    end

    subgraph EX["External Services"]
        direction TB
        OCR[OCR Service]:::external
        LTX[LaTeX Integration]:::external
        SVG[SVG to Excalidraw]:::external
    end

    subgraph SI["Storage & Integration"]
        direction TB
        OA[Obsidian API]:::storage
        FS[File System]:::storage
        SU[Shared Utilities]:::storage
        SE[Script Engine]:::storage
    end

    %% Relationships
    UI --> CS
    CS --> UI
    CS --> SI
    SI --> CS
    ES --> CS
    CS --> ES
    CS --> EX
    EX --> CS

    %% Event Manager connections
    EM --> UI
    EM --> ES
    EM --> EX
    EM --> SI

    %% Click events
    click ED "https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/src/core/editor/"
    click DG "https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/src/shared/Dialogs/"
    click MN "https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/src/view/components/menu/"
    click TP "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/view/components/menu/ToolsPanel.tsx"
    click CM "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/managers/CommandManager.ts"
    click EM "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/managers/EventManager.ts"
    click FM "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/managers/FileManager.ts"
    click PM "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/managers/PackageManager.ts"
    click SM "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/managers/StylesManager.ts"
    click OM "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/managers/ObserverManager.ts"
    click ST "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/settings.ts"
    click LS "https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/src/lang/"
    click OCR "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/shared/OCR/Taskbone.ts"
    click LTX "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/shared/LaTeX.ts"
    click SVG "https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/src/shared/svgToExcalidraw/"
    click SE "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/shared/Scripts.ts"
    click FS "https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/utils/fileUtils.ts"
    click SU "https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/src/utils/"

    %% Styling
    classDef ui fill:#2196F3,stroke:#fff,stroke-width:2px,color:#fff
    classDef core fill:#4CAF50,stroke:#fff,stroke-width:2px,color:#fff
    classDef editor fill:#9C27B0,stroke:#fff,stroke-width:2px,color:#fff
    classDef settings fill:#673AB7,stroke:#fff,stroke-width:2px,color:#fff
    classDef external fill:#FF9800,stroke:#fff,stroke-width:2px,color:#fff
    classDef storage fill:#607D8B,stroke:#fff,stroke-width:2px,color:#fff

    %% Legend
    subgraph Legend
        UI_L[UI Components]:::ui
        CORE_L[Core Services]:::core
        EDITOR_L[Editor]:::editor
        SETTINGS_L[Settings]:::settings
        EXTERNAL_L[External Services]:::external
        STORAGE_L[Storage & Integration]:::storage
    end
```
