# sergei-korneev/obsidian-local-images-plus architecture

> Architecture diagram of the GitHub repository sergei-korneev/obsidian-local-images-plus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sergei-korneev/obsidian-local-images-plus
- Repository: https://github.com/sergei-korneev/obsidian-local-images-plus

## Overview

Obsidian Local Images Plus is an Obsidian plugin that localizes remote, embedded, and local attachments referenced by notes, then updates note links. Users can trigger processing manually or enable automatic processing; the plugin also supports individual-image context-menu downloads and orphan cleanup. The graph separates note orchestration, attachment processing, settings, and shared helpers. Main-to-module links are supported by the source index and excerpts; feature and vault relationships are documented in the README. Some implementation details are unsampled, so uncertain internal calls are omitted.

Main entry points: [`src/main.ts`](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts) (Plugin orchestration), [`src/contentProcessor.ts`](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts) (Attachment processing), [`src/settingstab.ts`](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/settingstab.ts) (Settings interface), [`src/utils.ts`](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/utils.ts) (File and network helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Note workflow"]
  node_plugin["Plugin orchestration<br/>[main.ts]"]
  node_note_scan["Note scanning<br/>[main.ts]"]
  node_link_update["Note link updates<br/>[main.ts]"]
  node_orphan_cleanup["Orphan cleanup<br/>[main.ts]"]
end

subgraph group_attachments["Attachment handling"]
  node_attachment_processor["Attachment processing"]
  node_source_read["Source acquisition"]
  node_naming_dedup["Naming and dedup"]
  node_image_conversion["PNG conversion"]
  node_context_download["Single-image download<br/>[main.ts]"]
end

subgraph group_controls["Plugin controls"]
  node_settings_ui["Settings interface<br/>[settingstab.ts]"]
  node_confirmation["Confirmation dialogs<br/>[modal.ts]"]
end

subgraph group_shared["Shared support"]
  node_settings["Plugin configuration<br/>[config.ts]"]
  node_helpers["File and network helpers<br/>[utils.ts]"]
  node_retry_queue["Retry queue<br/>[uniqueQueue.ts]"]
end

node_user(("Obsidian user"))
node_obsidian[("Obsidian vault")]
node_web(("Web sources"))

node_user -->|"starts processing"| node_plugin
node_plugin -->|"scans notes"| node_note_scan
node_note_scan -->|"processes links"| node_attachment_processor
node_attachment_processor -->|"reads sources"| node_source_read
node_web -->|"provides media"| node_source_read
node_source_read -->|"downloads or reads"| node_helpers
node_attachment_processor -->|"chooses names"| node_naming_dedup
node_attachment_processor -->|"converts PNG"| node_image_conversion
node_plugin -->|"updates notes"| node_link_update
node_link_update -->|"modifies notes"| node_obsidian
node_plugin -->|"removes orphans"| node_orphan_cleanup
node_orphan_cleanup -->|"trashes attachments"| node_obsidian
node_user -->|"selects image"| node_context_download
node_context_download -.->|"requests download"| node_plugin
node_plugin -.->|"registers settings"| node_settings_ui
node_plugin -.->|"opens dialogs"| node_confirmation
node_settings_ui -->|"saves settings"| node_plugin
node_plugin -->|"uses utilities"| node_helpers
node_plugin -.->|"queues retries"| node_retry_queue

click node_plugin "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts"
click node_note_scan "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts"
click node_link_update "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts"
click node_orphan_cleanup "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts"
click node_attachment_processor "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts"
click node_source_read "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts"
click node_naming_dedup "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts"
click node_image_conversion "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts"
click node_context_download "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts"
click node_settings_ui "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/settingstab.ts"
click node_confirmation "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/modal.ts"
click node_settings "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/config.ts"
click node_helpers "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/utils.ts"
click node_retry_queue "https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/uniqueQueue.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_plugin,node_note_scan,node_link_update,node_orphan_cleanup,node_user toneBlue
class node_attachment_processor,node_source_read,node_naming_dedup,node_image_conversion,node_context_download,node_obsidian toneAmber
class node_settings_ui,node_confirmation toneMint
class node_settings,node_helpers,node_retry_queue toneRose
class node_web toneIndigo
```

## Components

### Note workflow

- [Plugin orchestration](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts): `src/main.ts`
- [Note scanning](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts): `src/main.ts`
- [Note link updates](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts): `src/main.ts`
- [Orphan cleanup](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts): `src/main.ts`

### Attachment handling

- [Attachment processing](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts): `src/contentProcessor.ts`
- [Source acquisition](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts): `src/contentProcessor.ts`
- [Naming and dedup](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts): `src/contentProcessor.ts`
- [PNG conversion](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/contentProcessor.ts): `src/contentProcessor.ts`
- [Single-image download](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/main.ts): `src/main.ts`

### Plugin controls

- [Settings interface](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/settingstab.ts): `src/settingstab.ts`
- [Confirmation dialogs](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/modal.ts): `src/modal.ts`

### Shared support

- [Plugin configuration](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/config.ts): `src/config.ts`
- [File and network helpers](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/utils.ts): `src/utils.ts`
- [Retry queue](https://github.com/sergei-korneev/obsidian-local-images-plus/blob/main/src/uniqueQueue.ts): `src/uniqueQueue.ts`

### Other components

- **Obsidian user**
- **Obsidian vault**
- **Web sources**

## Connections

- Obsidian user → Plugin orchestration: starts processing (evidence: `README.md`)
- Plugin orchestration → Note scanning: scans notes (evidence: `src/main.ts`)
- Note scanning → Attachment processing: processes links (evidence: `src/main.ts`)
- Attachment processing → Source acquisition: reads sources (evidence: `src/contentProcessor.ts`)
- Web sources → Source acquisition: provides media (evidence: `README.md`)
- Source acquisition → File and network helpers: downloads or reads (evidence: `src/contentProcessor.ts`)
- Attachment processing → Naming and dedup: chooses names (evidence: `src/contentProcessor.ts`)
- Attachment processing → PNG conversion: converts PNG (evidence: `src/contentProcessor.ts`)
- Plugin orchestration → Note link updates: updates notes (evidence: `src/main.ts`)
- Note link updates → Obsidian vault: modifies notes (evidence: `src/main.ts`)
- Plugin orchestration → Orphan cleanup: removes orphans (evidence: `README.md`)
- Orphan cleanup → Obsidian vault: trashes attachments (evidence: `src/main.ts`)
- Obsidian user → Single-image download: selects image (evidence: `README.md`)
- Single-image download → Plugin orchestration: requests download (evidence: `src/main.ts`)
- Plugin orchestration → Settings interface: registers settings (evidence: `src/main.ts`)
- Plugin orchestration → Confirmation dialogs: opens dialogs (evidence: `src/main.ts`)
- Settings interface → Plugin orchestration: saves settings (evidence: `src/settingstab.ts`)
- Plugin orchestration → File and network helpers: uses utilities (evidence: `src/main.ts`)
- Plugin orchestration → Retry queue: queues retries (evidence: `src/main.ts`)
