# ai4pastor/a4p-bible-verse architecture

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

- Interactive diagram: https://gitdiagram.com/ai4pastor/a4p-bible-verse
- Repository: https://github.com/ai4pastor/a4p-bible-verse

## Overview

A4P Bible Verse is an Obsidian plugin for finding Bible passages and inserting linked quotations into the active note. Its main workflow parses a reference or keyword query, loads verse data or builds/uses a keyword index, presents selectable results, then formats and inserts or copies them. The README also documents editor autocomplete, parallel-version insertion, related-passage exploration, inline previews, commentary shortcuts, and cited-sermon discovery. Connections below use excerpts or README statements; paths and links for unsampled features are limited to documented evidence.

Main entry points: [`src/modal.ts`](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.ts) (Search modal), [`src/bible-data.ts`](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/bible-data.ts) (Verse access), [`src/main.ts`](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/main.ts) (Plugin commands), [`src/verse-index.ts`](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/verse-index.ts) (Keyword index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_query["Search and results"]
  node_plugin["Plugin commands<br/>[main.ts]"]
  node_modal["Search modal<br/>[modal.ts]"]
  node_refparse["Reference parser"]
  node_keyword["Keyword search<br/>[search.ts]"]
  node_books["Book catalog<br/>[books.ts]"]
end

subgraph group_data["Verse data"]
  node_bibledata["Verse access<br/>[bible-data.ts]"]
  node_notep["Verse note parser<br/>[note-parser.ts]"]
  node_versefiles["Verse file lookup<br/>[verse-files.ts]"]
  node_index[("Keyword index<br/>[verse-index.ts]")]
end

subgraph group_output["Insertion and autocomplete"]
  node_formatter["Output formatter<br/>[formatter.ts]"]
  node_insert["Editor insertion<br/>[insert.ts]"]
  node_autocomplete["Editor autocomplete<br/>[suggest.ts]"]
end

subgraph group_config["Settings and versions"]
  node_settings["Settings panel<br/>[settings.ts]"]
  node_migration["Settings migration"]
  node_versions["Version settings<br/>[versions.ts]"]
  node_addversion["Add version dialog"]
end

subgraph group_context["Study context"]
  node_commentary["Commentary lookup<br/>[bible-data.ts]"]
  node_contextpreview["Related and inline previews<br/>[modal.ts]"]
  node_sermons["Citing sermons<br/>[modal.ts]"]
end

node_user(("Obsidian user"))
node_vault[("Obsidian vault")]
node_active_note["Active note"]

node_user -->|"runs command"| node_plugin
node_plugin -->|"opens"| node_modal
node_plugin -->|"creates"| node_bibledata
node_plugin -->|"registers"| node_settings
node_plugin -->|"migrates settings"| node_migration
node_modal -->|"parses reference"| node_refparse
node_modal -->|"searches keywords"| node_keyword
node_modal -->|"loads verses"| node_bibledata
node_modal -->|"requests index"| node_index
node_index -->|"reads verse notes"| node_bibledata
node_index -->|"extracts text"| node_notep
node_index -->|"normalizes text"| node_keyword
node_bibledata -->|"indexes files"| node_versefiles
node_bibledata -->|"parses note body"| node_notep
node_bibledata -->|"reads files"| node_vault
node_refparse -->|"resolves books"| node_books
node_modal -->|"formats selections"| node_formatter
node_modal -->|"inserts block"| node_insert
node_insert -->|"writes content"| node_active_note
node_plugin -->|"registers editor suggest"| node_autocomplete
node_autocomplete -->|"parses trigger text"| node_refparse
node_autocomplete -->|"formats suggestion"| node_formatter
node_settings -->|"opens dialog"| node_addversion
node_settings -->|"validates folders"| node_bibledata
node_settings -->|"manages versions"| node_versions
node_plugin -->|"sanitizes settings"| node_versions
node_bibledata -.->|"builds lookup"| node_commentary
node_modal -->|"shows context"| node_contextpreview
node_modal -->|"finds citations"| node_sermons
node_contextpreview -->|"opens linked notes"| node_vault
node_sermons -->|"searches notes"| node_vault

click node_plugin "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/main.ts"
click node_modal "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.ts"
click node_refparse "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/reference-parser.ts"
click node_keyword "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/search.ts"
click node_books "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/books.ts"
click node_bibledata "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/bible-data.ts"
click node_notep "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/note-parser.ts"
click node_versefiles "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/verse-files.ts"
click node_index "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/verse-index.ts"
click node_formatter "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/formatter.ts"
click node_insert "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/insert.ts"
click node_autocomplete "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/suggest.ts"
click node_settings "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/settings.ts"
click node_migration "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/settings-migrate.ts"
click node_versions "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/versions.ts"
click node_addversion "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/add-version-modal.ts"
click node_commentary "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/bible-data.ts"
click node_contextpreview "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.ts"
click node_sermons "https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.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_modal,node_refparse,node_keyword,node_books,node_user toneBlue
class node_bibledata,node_notep,node_versefiles,node_index,node_vault toneAmber
class node_formatter,node_insert,node_autocomplete toneMint
class node_settings,node_migration,node_versions,node_addversion toneRose
class node_commentary,node_contextpreview,node_sermons,node_active_note toneIndigo
```

## Components

### Search and results

- [Plugin commands](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/main.ts): `src/main.ts`
- [Search modal](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.ts): `src/modal.ts`
- [Reference parser](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/reference-parser.ts): `src/reference-parser.ts`
- [Keyword search](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/search.ts): `src/search.ts`
- [Book catalog](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/books.ts): `src/books.ts`

### Verse data

- [Verse access](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/bible-data.ts): `src/bible-data.ts`
- [Verse note parser](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/note-parser.ts): `src/note-parser.ts`
- [Verse file lookup](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/verse-files.ts): `src/verse-files.ts`
- [Keyword index](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/verse-index.ts): `src/verse-index.ts`

### Insertion and autocomplete

- [Output formatter](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/formatter.ts): `src/formatter.ts`
- [Editor insertion](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/insert.ts): `src/insert.ts`
- [Editor autocomplete](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/suggest.ts): `src/suggest.ts`

### Settings and versions

- [Settings panel](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/settings.ts): `src/settings.ts`
- [Settings migration](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/settings-migrate.ts): `src/settings-migrate.ts`
- [Version settings](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/versions.ts): `src/versions.ts`
- [Add version dialog](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/add-version-modal.ts): `src/add-version-modal.ts`

### Study context

- [Commentary lookup](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/bible-data.ts): `src/bible-data.ts`
- [Related and inline previews](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.ts): `src/modal.ts`
- [Citing sermons](https://github.com/ai4pastor/a4p-bible-verse/blob/master/src/modal.ts): `src/modal.ts`

### Other components

- **Obsidian user**
- **Obsidian vault**
- **Active note**

## Connections

- Obsidian user → Plugin commands: runs command (evidence: `README.md`)
- Plugin commands → Search modal: opens (evidence: `src/main.ts`)
- Plugin commands → Verse access: creates (evidence: `src/main.ts`)
- Plugin commands → Settings panel: registers (evidence: `src/main.ts`)
- Plugin commands → Settings migration: migrates settings (evidence: `src/main.ts`)
- Search modal → Reference parser: parses reference (evidence: `src/modal.ts`)
- Search modal → Keyword search: searches keywords (evidence: `src/modal.ts`)
- Search modal → Verse access: loads verses (evidence: `src/modal.ts`)
- Search modal → Keyword index: requests index (evidence: `README.md`)
- Keyword index → Verse access: reads verse notes (evidence: `src/verse-index.ts`)
- Keyword index → Verse note parser: extracts text (evidence: `src/verse-index.ts`)
- Keyword index → Keyword search: normalizes text (evidence: `src/verse-index.ts`)
- Verse access → Verse file lookup: indexes files (evidence: `src/bible-data.ts`)
- Verse access → Verse note parser: parses note body (evidence: `src/bible-data.ts`)
- Verse access → Obsidian vault: reads files (evidence: `README.md`)
- Reference parser → Book catalog: resolves books (evidence: `src/reference-parser.ts`)
- Search modal → Output formatter: formats selections (evidence: `src/modal.ts`)
- Search modal → Editor insertion: inserts block (evidence: `src/modal.ts`)
- Editor insertion → Active note: writes content (evidence: `README.md`)
- Plugin commands → Editor autocomplete: registers editor suggest (evidence: `src/main.ts`)
- Editor autocomplete → Reference parser: parses trigger text (evidence: `src/suggest.ts`)
- Editor autocomplete → Output formatter: formats suggestion (evidence: `src/suggest.ts`)
- Settings panel → Add version dialog: opens dialog (evidence: `src/settings.ts`)
- Settings panel → Verse access: validates folders (evidence: `src/settings.ts`)
- Settings panel → Version settings: manages versions (evidence: `README.md`)
- Plugin commands → Version settings: sanitizes settings (evidence: `src/main.ts`)
- Verse access → Commentary lookup: builds lookup (evidence: `src/bible-data.ts`)
- Search modal → Related and inline previews: shows context (evidence: `README.md`)
- Search modal → Citing sermons: finds citations (evidence: `README.md`)
- Related and inline previews → Obsidian vault: opens linked notes (evidence: `README.md`)
- Citing sermons → Obsidian vault: searches notes (evidence: `README.md`)
