# ericjy/markside architecture

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

- Interactive diagram: https://gitdiagram.com/ericjy/markside
- Repository: https://github.com/ericjy/markside
- Video tour (about a minute): https://gitdiagram.com/ericjy/markside/video

## Overview

Markside is a Chrome workspace for local Markdown: users open a file, navigate nearby files, read rendered content, review or edit it, and save changes. It also supports document and localhost reviews, readability checks, and link or hosted snapshots. The graph preserves these documented capabilities; relationships among unsampled UI and feature modules are omitted where the excerpts do not show their wiring.

Main entry points: [`components/content-app.tsx`](https://github.com/ericjy/markside/blob/main/components/content-app.tsx) (Content workspace), [`lib/localhost-review.ts`](https://github.com/ericjy/markside/blob/main/lib/localhost-review.ts) (Localhost review), [`hooks/use-content-snapshots.ts`](https://github.com/ericjy/markside/blob/main/hooks/use-content-snapshots.ts) (Snapshot sharing), [`lib/hosted-snapshot.ts`](https://github.com/ericjy/markside/blob/main/lib/hosted-snapshot.ts) (Hosted snapshot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["File Workspace"]
  node_app["Content workspace<br/>[content-app.tsx]"]
  node_fileload["File loading"]
  node_filetree["File navigation<br/>[file-tree.tsx]"]
  node_render["Markdown rendering<br/>[markdown.ts]"]
  node_frontmatter["Frontmatter parsing<br/>[frontmatter.ts]"]
  node_editor["Source editor<br/>[raw-editor.tsx]"]
  node_save["Save and reload"]
  node_export["PDF export<br/>[pdf-export.ts]"]
end

subgraph group_review["Reviews"]
  node_docreview["Document review"]
  node_reviewpolicy["Review rules and anchors<br/>[review.ts]"]
  node_reviewdom["Review highlighting<br/>[review-dom.ts]"]
  node_reviewui["Review panel<br/>[review-panel.tsx]"]
  node_localhost["Localhost review"]
  node_localhostui["Localhost review panel"]
  node_reviewstore[("Review persistence")]
  node_reviewindex["Review index<br/>[review-index.ts]"]
  node_readability["Readability check<br/>[readability.ts]"]
  node_readabilityservice["Readability service"]
end

subgraph group_sharing["Sharing and Export"]
  node_snapshot["Snapshot sharing"]
  node_linkshot["Link snapshot<br/>[link-snapshot.ts]"]
  node_hostedshot["Hosted snapshot<br/>[hosted-snapshot.ts]"]
end

subgraph group_extension["Extension Features"]
  node_background["Extension background<br/>[background.ts]"]
  node_popup["Extension popup<br/>[popup.tsx]"]
  node_options["Preferences<br/>[options.tsx]"]
end

node_user(("Reader / editor"))
node_chrome(("Chrome browser"))
node_localfiles[("Local Markdown files")]
node_recipient(("Snapshot recipient"))
node_agent(("Coding agent"))

node_user -->|"opens file"| node_chrome
node_chrome -->|"loads workspace"| node_app
node_app -.->|"loads content"| node_fileload
node_fileload -.->|"reads file"| node_localfiles
node_app -.->|"offers navigation"| node_filetree
node_app -.->|"renders preview"| node_render
node_render -->|"parses metadata"| node_frontmatter
node_app -.->|"offers source editing"| node_editor
node_app -.->|"saves edits"| node_save
node_save -.->|"writes file"| node_localfiles
node_app -.->|"exports PDF"| node_export
node_user -->|"adds review comments"| node_docreview
node_docreview -.->|"resolves anchors"| node_reviewpolicy
node_reviewdom -->|"uses anchor rules"| node_reviewpolicy
node_app -.->|"presents review"| node_reviewui
node_user -->|"reviews local app"| node_localhostui
node_localhostui -.->|"manages annotations"| node_localhost
node_localhost -->|"uses shared anchors"| node_reviewpolicy
node_localhost -.->|"persists review"| node_reviewstore
node_reviewstore -->|"updates index"| node_reviewindex
node_user -->|"checks prose"| node_readability
node_readability -->|"parses document"| node_frontmatter
node_readabilityservice -->|"sends check request"| node_background
node_background -.->|"processes request"| node_readability
node_user -->|"shares snapshot"| node_snapshot
node_snapshot -.->|"creates link snapshot"| node_linkshot
node_snapshot -.->|"creates hosted snapshot"| node_hostedshot
node_linkshot -->|"opens encoded content"| node_recipient
node_hostedshot -->|"opens encrypted copy"| node_recipient
node_hostedshot -.->|"uploads ciphertext"| node_chrome
node_user -.->|"opens extension menu"| node_popup
node_popup -.->|"lists review index"| node_reviewstore
node_user -.->|"sets preferences"| node_options
node_agent -.->|"requests file opening"| node_background

click node_app "https://github.com/ericjy/markside/blob/main/components/content-app.tsx"
click node_fileload "https://github.com/ericjy/markside/blob/main/hooks/use-content-file-loading.ts"
click node_filetree "https://github.com/ericjy/markside/blob/main/components/file-tree.tsx"
click node_render "https://github.com/ericjy/markside/blob/main/lib/markdown.ts"
click node_frontmatter "https://github.com/ericjy/markside/blob/main/lib/frontmatter.ts"
click node_editor "https://github.com/ericjy/markside/blob/main/components/raw-editor.tsx"
click node_save "https://github.com/ericjy/markside/blob/main/hooks/use-content-save.ts"
click node_export "https://github.com/ericjy/markside/blob/main/lib/pdf-export.ts"
click node_docreview "https://github.com/ericjy/markside/blob/main/hooks/use-content-review.ts"
click node_reviewpolicy "https://github.com/ericjy/markside/blob/main/lib/review.ts"
click node_reviewdom "https://github.com/ericjy/markside/blob/main/lib/review-dom.ts"
click node_reviewui "https://github.com/ericjy/markside/blob/main/components/review-panel.tsx"
click node_localhost "https://github.com/ericjy/markside/blob/main/lib/localhost-review.ts"
click node_localhostui "https://github.com/ericjy/markside/blob/main/components/localhost-review-panel.tsx"
click node_reviewstore "https://github.com/ericjy/markside/blob/main/lib/review-index-storage.ts"
click node_reviewindex "https://github.com/ericjy/markside/blob/main/lib/review-index.ts"
click node_readability "https://github.com/ericjy/markside/blob/main/lib/readability.ts"
click node_readabilityservice "https://github.com/ericjy/markside/blob/main/lib/readability-service.ts"
click node_snapshot "https://github.com/ericjy/markside/blob/main/hooks/use-content-snapshots.ts"
click node_linkshot "https://github.com/ericjy/markside/blob/main/lib/link-snapshot.ts"
click node_hostedshot "https://github.com/ericjy/markside/blob/main/lib/hosted-snapshot.ts"
click node_background "https://github.com/ericjy/markside/blob/main/background.ts"
click node_popup "https://github.com/ericjy/markside/blob/main/popup.tsx"
click node_options "https://github.com/ericjy/markside/blob/main/options.tsx"

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_app,node_fileload,node_filetree,node_render,node_frontmatter,node_editor,node_save,node_export,node_chrome toneBlue
class node_docreview,node_reviewpolicy,node_reviewdom,node_reviewui,node_localhost,node_localhostui,node_reviewstore,node_reviewindex,node_readability,node_readabilityservice,node_localfiles toneAmber
class node_snapshot,node_linkshot,node_hostedshot toneMint
class node_background,node_popup,node_options toneRose
class node_user,node_recipient,node_agent toneIndigo
```

## Components

### File Workspace

- [Content workspace](https://github.com/ericjy/markside/blob/main/components/content-app.tsx): `components/content-app.tsx`
- [File loading](https://github.com/ericjy/markside/blob/main/hooks/use-content-file-loading.ts): `hooks/use-content-file-loading.ts`
- [File navigation](https://github.com/ericjy/markside/blob/main/components/file-tree.tsx): `components/file-tree.tsx`
- [Markdown rendering](https://github.com/ericjy/markside/blob/main/lib/markdown.ts): `lib/markdown.ts`
- [Frontmatter parsing](https://github.com/ericjy/markside/blob/main/lib/frontmatter.ts): `lib/frontmatter.ts`
- [Source editor](https://github.com/ericjy/markside/blob/main/components/raw-editor.tsx): `components/raw-editor.tsx`
- [Save and reload](https://github.com/ericjy/markside/blob/main/hooks/use-content-save.ts): `hooks/use-content-save.ts`
- [PDF export](https://github.com/ericjy/markside/blob/main/lib/pdf-export.ts): `lib/pdf-export.ts`

### Reviews

- [Document review](https://github.com/ericjy/markside/blob/main/hooks/use-content-review.ts): `hooks/use-content-review.ts`
- [Review rules and anchors](https://github.com/ericjy/markside/blob/main/lib/review.ts): `lib/review.ts`
- [Review highlighting](https://github.com/ericjy/markside/blob/main/lib/review-dom.ts): `lib/review-dom.ts`
- [Review panel](https://github.com/ericjy/markside/blob/main/components/review-panel.tsx): `components/review-panel.tsx`
- [Localhost review](https://github.com/ericjy/markside/blob/main/lib/localhost-review.ts): `lib/localhost-review.ts`
- [Localhost review panel](https://github.com/ericjy/markside/blob/main/components/localhost-review-panel.tsx): `components/localhost-review-panel.tsx`
- [Review persistence](https://github.com/ericjy/markside/blob/main/lib/review-index-storage.ts): `lib/review-index-storage.ts`
- [Review index](https://github.com/ericjy/markside/blob/main/lib/review-index.ts): `lib/review-index.ts`
- [Readability check](https://github.com/ericjy/markside/blob/main/lib/readability.ts): `lib/readability.ts`
- [Readability service](https://github.com/ericjy/markside/blob/main/lib/readability-service.ts): `lib/readability-service.ts`

### Sharing and Export

- [Snapshot sharing](https://github.com/ericjy/markside/blob/main/hooks/use-content-snapshots.ts): `hooks/use-content-snapshots.ts`
- [Link snapshot](https://github.com/ericjy/markside/blob/main/lib/link-snapshot.ts): `lib/link-snapshot.ts`
- [Hosted snapshot](https://github.com/ericjy/markside/blob/main/lib/hosted-snapshot.ts): `lib/hosted-snapshot.ts`

### Extension Features

- [Extension background](https://github.com/ericjy/markside/blob/main/background.ts): `background.ts`
- [Extension popup](https://github.com/ericjy/markside/blob/main/popup.tsx): `popup.tsx`
- [Preferences](https://github.com/ericjy/markside/blob/main/options.tsx): `options.tsx`

### Other components

- **Reader / editor**
- **Chrome browser**
- **Local Markdown files**
- **Snapshot recipient**
- **Coding agent**

## Connections

- Reader / editor → Chrome browser: opens file
- Chrome browser → Content workspace: loads workspace
- Content workspace → File loading: loads content
- File loading → Local Markdown files: reads file
- Content workspace → File navigation: offers navigation
- Content workspace → Markdown rendering: renders preview
- Markdown rendering → Frontmatter parsing: parses metadata (evidence: `lib/readability.ts`)
- Content workspace → Source editor: offers source editing
- Content workspace → Save and reload: saves edits
- Save and reload → Local Markdown files: writes file
- Content workspace → PDF export: exports PDF
- Reader / editor → Document review: adds review comments
- Document review → Review rules and anchors: resolves anchors
- Review highlighting → Review rules and anchors: uses anchor rules (evidence: `lib/review-dom.ts`)
- Content workspace → Review panel: presents review
- Reader / editor → Localhost review panel: reviews local app
- Localhost review panel → Localhost review: manages annotations
- Localhost review → Review rules and anchors: uses shared anchors (evidence: `lib/localhost-review.ts`)
- Localhost review → Review persistence: persists review
- Review persistence → Review index: updates index (evidence: `lib/review-index-storage.ts`)
- Reader / editor → Readability check: checks prose
- Readability check → Frontmatter parsing: parses document (evidence: `lib/readability.ts`)
- Readability service → Extension background: sends check request (evidence: `lib/readability-service.ts`)
- Extension background → Readability check: processes request
- Reader / editor → Snapshot sharing: shares snapshot
- Snapshot sharing → Link snapshot: creates link snapshot
- Snapshot sharing → Hosted snapshot: creates hosted snapshot
- Link snapshot → Snapshot recipient: opens encoded content
- Hosted snapshot → Snapshot recipient: opens encrypted copy
- Hosted snapshot → Chrome browser: uploads ciphertext
- Reader / editor → Extension popup: opens extension menu
- Extension popup → Review persistence: lists review index
- Reader / editor → Preferences: sets preferences
- Coding agent → Extension background: requests file opening
