# kenforthewin/atomic-editor architecture

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

- Interactive diagram: https://gitdiagram.com/kenforthewin/atomic-editor
- Repository: https://github.com/kenforthewin/atomic-editor

## Overview

Atomic Editor is a React/CodeMirror 6 Markdown writing surface: users edit plain Markdown while decorations render a live, layout-stable view, and the Markdown remains the source of truth. Its main workflow runs through the React editor into CodeMirror, where preview, tables, images, and optional wiki links provide editing and reading features; callbacks and the imperative handle expose results and controls. The README also documents search/reveal, syntax highlighting, smart-list editing, theming, and read-only mode. Some feature wiring is inferred from imports or documentation, not fully sampled.

Main entry points: [`src/AtomicCodeMirrorEditor.tsx`](https://github.com/kenforthewin/atomic-editor/blob/main/src/AtomicCodeMirrorEditor.tsx) (React editor), [`src/tree-progress.ts`](https://github.com/kenforthewin/atomic-editor/blob/main/src/tree-progress.ts) (Parser progress), [`src/wiki-links.ts`](https://github.com/kenforthewin/atomic-editor/blob/main/src/wiki-links.ts) (Wiki links), [`src/inline-preview.ts`](https://github.com/kenforthewin/atomic-editor/blob/main/src/inline-preview.ts) (Inline preview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor runtime"]
  node_editor["React editor"]
  node_cm["CodeMirror view"]
end

subgraph group_render["Markdown rendering"]
  node_inline["Inline preview<br/>[inline-preview.ts]"]
  node_syntax["Markdown syntax<br/>[highlight.ts]"]
  node_tables["Table widgets<br/>[table-widget.ts]"]
  node_images["Image blocks<br/>[image-blocks.ts]"]
  node_progress["Parser progress<br/>[tree-progress.ts]"]
end

subgraph group_features["Editing features"]
  node_wiki["Wiki links<br/>[wiki-links.ts]"]
  node_edit["Smart editing<br/>[edit-helpers.ts]"]
  node_languages["Code languages<br/>[code-languages.ts]"]
end

subgraph group_presentation["Reading and presentation"]
  node_readonly["Read-only mode<br/>[read-only.ts]"]
  node_search["Search and reveal"]
  node_theme["Editor theme<br/>[atomic-theme.ts]"]
end

node_writer(("Markdown author"))
node_resolver["Link resolver"]

node_writer -->|"edits Markdown"| node_editor
node_editor -->|"creates view"| node_cm
node_editor -->|"configures preview"| node_inline
node_editor -->|"configures tables"| node_tables
node_editor -->|"configures images"| node_images
node_editor -.->|"composes extension"| node_wiki
node_editor -.->|"adds key handlers"| node_edit
node_editor -->|"reconfigures mode"| node_readonly
node_editor -->|"provides controls"| node_search
node_editor -.->|"applies theme"| node_theme
node_editor -.->|"accepts language list"| node_languages
node_inline -.->|"uses delimiters"| node_syntax
node_tables -->|"parses highlights"| node_syntax
node_progress -->|"signals parse growth"| node_inline
node_progress -->|"signals parse growth"| node_tables
node_progress -->|"signals parse growth"| node_images
node_wiki -->|"resolves targets"| node_resolver
node_wiki -->|"opens links"| node_writer
node_editor -->|"returns Markdown"| node_writer
node_editor -->|"exposes imperative controls"| node_writer

click node_editor "https://github.com/kenforthewin/atomic-editor/blob/main/src/AtomicCodeMirrorEditor.tsx"
click node_inline "https://github.com/kenforthewin/atomic-editor/blob/main/src/inline-preview.ts"
click node_syntax "https://github.com/kenforthewin/atomic-editor/blob/main/src/highlight.ts"
click node_tables "https://github.com/kenforthewin/atomic-editor/blob/main/src/table-widget.ts"
click node_images "https://github.com/kenforthewin/atomic-editor/blob/main/src/image-blocks.ts"
click node_progress "https://github.com/kenforthewin/atomic-editor/blob/main/src/tree-progress.ts"
click node_wiki "https://github.com/kenforthewin/atomic-editor/blob/main/src/wiki-links.ts"
click node_edit "https://github.com/kenforthewin/atomic-editor/blob/main/src/edit-helpers.ts"
click node_languages "https://github.com/kenforthewin/atomic-editor/blob/main/src/code-languages.ts"
click node_readonly "https://github.com/kenforthewin/atomic-editor/blob/main/src/read-only.ts"
click node_search "https://github.com/kenforthewin/atomic-editor/blob/main/src/AtomicCodeMirrorEditor.tsx"
click node_theme "https://github.com/kenforthewin/atomic-editor/blob/main/src/atomic-theme.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_editor,node_cm toneBlue
class node_inline,node_syntax,node_tables,node_images,node_progress toneAmber
class node_wiki,node_edit,node_languages toneMint
class node_readonly,node_search,node_theme toneRose
class node_writer,node_resolver toneIndigo
```

## Components

### Editor runtime

- [React editor](https://github.com/kenforthewin/atomic-editor/blob/main/src/AtomicCodeMirrorEditor.tsx): `src/AtomicCodeMirrorEditor.tsx`
- **CodeMirror view**

### Markdown rendering

- [Inline preview](https://github.com/kenforthewin/atomic-editor/blob/main/src/inline-preview.ts): `src/inline-preview.ts`
- [Markdown syntax](https://github.com/kenforthewin/atomic-editor/blob/main/src/highlight.ts): `src/highlight.ts`
- [Table widgets](https://github.com/kenforthewin/atomic-editor/blob/main/src/table-widget.ts): `src/table-widget.ts`
- [Image blocks](https://github.com/kenforthewin/atomic-editor/blob/main/src/image-blocks.ts): `src/image-blocks.ts`
- [Parser progress](https://github.com/kenforthewin/atomic-editor/blob/main/src/tree-progress.ts): `src/tree-progress.ts`

### Editing features

- [Wiki links](https://github.com/kenforthewin/atomic-editor/blob/main/src/wiki-links.ts): `src/wiki-links.ts`
- [Smart editing](https://github.com/kenforthewin/atomic-editor/blob/main/src/edit-helpers.ts): `src/edit-helpers.ts`
- [Code languages](https://github.com/kenforthewin/atomic-editor/blob/main/src/code-languages.ts): `src/code-languages.ts`

### Reading and presentation

- [Read-only mode](https://github.com/kenforthewin/atomic-editor/blob/main/src/read-only.ts): `src/read-only.ts`
- [Search and reveal](https://github.com/kenforthewin/atomic-editor/blob/main/src/AtomicCodeMirrorEditor.tsx): `src/AtomicCodeMirrorEditor.tsx`
- [Editor theme](https://github.com/kenforthewin/atomic-editor/blob/main/src/atomic-theme.ts): `src/atomic-theme.ts`

### Other components

- **Markdown author**
- **Link resolver**

## Connections

- Markdown author → React editor: edits Markdown (evidence: `README.md`)
- React editor → CodeMirror view: creates view (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Inline preview: configures preview (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Table widgets: configures tables (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Image blocks: configures images (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Wiki links: composes extension
- React editor → Smart editing: adds key handlers (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Read-only mode: reconfigures mode (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Search and reveal: provides controls (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Editor theme: applies theme (evidence: `src/AtomicCodeMirrorEditor.tsx`)
- React editor → Code languages: accepts language list (evidence: `README.md`)
- Inline preview → Markdown syntax: uses delimiters
- Table widgets → Markdown syntax: parses highlights (evidence: `src/table-widget.ts`)
- Parser progress → Inline preview: signals parse growth (evidence: `src/tree-progress.ts`)
- Parser progress → Table widgets: signals parse growth (evidence: `src/tree-progress.ts`)
- Parser progress → Image blocks: signals parse growth (evidence: `src/tree-progress.ts`)
- Wiki links → Link resolver: resolves targets (evidence: `README.md`)
- Wiki links → Markdown author: opens links (evidence: `README.md`)
- React editor → Markdown author: returns Markdown (evidence: `README.md`)
- React editor → Markdown author: exposes imperative controls (evidence: `README.md`)
