# splieth/confluence2md architecture

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

- Interactive diagram: https://gitdiagram.com/splieth/confluence2md
- Repository: https://github.com/splieth/confluence2md

## Overview

confluence2md is a CLI and Python library for exporting Confluence content as Markdown. The main workflow loads and validates configuration, connects to Confluence, selects pages by ID, CQL, or space (optionally fetching children), then renders files with metadata and attachment images. A separate list-spaces command supports discovery. The source excerpts show CLI orchestration and renderer-to-attachment calls; README documents library use and image behavior. No filesystem store or additional pipeline is implied.

Main entry points: [`src/confluence2md/cli.py`](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/cli.py) (CLI commands), [`src/confluence2md/__init__.py`](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/__init__.py) (Python API), [`src/confluence2md/renderer.py`](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py) (Markdown rendering), [`src/confluence2md/client.py`](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py) (Page selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_library["Python API<br/>[__init__.py]"]
end

subgraph group_setup["Configuration"]
  node_config["Config loading<br/>[config.py]"]
end

subgraph group_confluence["Confluence access"]
  node_connector["Authenticated client<br/>[client.py]"]
  node_page_selection["Page selection<br/>[client.py]"]
  node_page_model["Page records<br/>[client.py]"]
  node_space_discovery["Space discovery<br/>[spaces.py]"]
  node_attachment_fetch["Attachment access<br/>[client.py]"]
end

subgraph group_export["Markdown export"]
  node_page_rendering["Markdown rendering<br/>[renderer.py]"]
  node_metadata["Metadata output<br/>[renderer.py]"]
  node_attachment_processing["Image processing<br/>[renderer.py]"]
  node_markdown_files["Markdown files"]
  node_image_files["Local image files"]
end

node_user(("User"))
node_confluence_service["Confluence"]

node_user -->|"runs"| node_cli
node_user -->|"calls"| node_library
node_cli -->|"loads"| node_config
node_cli -->|"validates"| node_config
node_cli -->|"connects"| node_connector
node_cli -->|"selects pages"| node_page_selection
node_cli -->|"lists spaces"| node_space_discovery
node_cli -->|"exports pages"| node_page_rendering
node_connector -->|"authenticates"| node_confluence_service
node_page_selection -->|"queries pages"| node_confluence_service
node_page_selection -->|"builds records"| node_page_model
node_space_discovery -->|"lists spaces"| node_confluence_service
node_page_rendering -->|"formats metadata"| node_metadata
node_page_rendering -->|"processes images"| node_attachment_processing
node_attachment_processing -->|"fetches attachments"| node_attachment_fetch
node_attachment_processing -->|"downloads images"| node_image_files
node_attachment_fetch -->|"downloads data"| node_confluence_service
node_page_rendering -->|"writes Markdown"| node_markdown_files
node_library -->|"exports API"| node_config
node_library -->|"exports API"| node_page_selection
node_library -->|"exports API"| node_page_rendering
node_library -->|"exports API"| node_space_discovery

click node_cli "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/cli.py"
click node_library "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/__init__.py"
click node_config "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/config.py"
click node_connector "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py"
click node_page_selection "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py"
click node_page_model "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py"
click node_space_discovery "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/spaces.py"
click node_page_rendering "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py"
click node_metadata "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py"
click node_attachment_processing "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py"
click node_attachment_fetch "https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py"

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_cli,node_library,node_user toneBlue
class node_config toneAmber
class node_connector,node_page_selection,node_page_model,node_space_discovery,node_attachment_fetch toneMint
class node_page_rendering,node_metadata,node_attachment_processing,node_markdown_files,node_image_files toneRose
class node_confluence_service toneIndigo
```

## Components

### Entry points

- [CLI commands](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/cli.py): `src/confluence2md/cli.py`
- [Python API](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/__init__.py): `src/confluence2md/__init__.py`

### Configuration

- [Config loading](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/config.py): `src/confluence2md/config.py`

### Confluence access

- [Authenticated client](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py): `src/confluence2md/client.py`
- [Page selection](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py): `src/confluence2md/client.py`
- [Page records](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py): `src/confluence2md/client.py`
- [Space discovery](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/spaces.py): `src/confluence2md/spaces.py`
- [Attachment access](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/client.py): `src/confluence2md/client.py`

### Markdown export

- [Markdown rendering](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py): `src/confluence2md/renderer.py`
- [Metadata output](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py): `src/confluence2md/renderer.py`
- [Image processing](https://github.com/splieth/confluence2md/blob/main/src/confluence2md/renderer.py): `src/confluence2md/renderer.py`
- **Markdown files**
- **Local image files**

### Other components

- **User**
- **Confluence**

## Connections

- User → CLI commands: runs (evidence: `README.md`)
- User → Python API: calls (evidence: `README.md`)
- CLI commands → Config loading: loads (evidence: `src/confluence2md/cli.py`)
- CLI commands → Config loading: validates (evidence: `src/confluence2md/cli.py`)
- CLI commands → Authenticated client: connects (evidence: `src/confluence2md/cli.py`)
- CLI commands → Page selection: selects pages (evidence: `src/confluence2md/cli.py`)
- CLI commands → Space discovery: lists spaces (evidence: `src/confluence2md/cli.py`)
- CLI commands → Markdown rendering: exports pages (evidence: `src/confluence2md/cli.py`)
- Authenticated client → Confluence: authenticates (evidence: `src/confluence2md/client.py`)
- Page selection → Confluence: queries pages (evidence: `src/confluence2md/client.py`)
- Page selection → Page records: builds records (evidence: `src/confluence2md/client.py`)
- Space discovery → Confluence: lists spaces (evidence: `src/confluence2md/spaces.py`)
- Markdown rendering → Metadata output: formats metadata (evidence: `src/confluence2md/renderer.py`)
- Markdown rendering → Image processing: processes images (evidence: `src/confluence2md/renderer.py`)
- Image processing → Attachment access: fetches attachments (evidence: `src/confluence2md/renderer.py`)
- Image processing → Local image files: downloads images (evidence: `src/confluence2md/renderer.py`)
- Attachment access → Confluence: downloads data (evidence: `src/confluence2md/client.py`)
- Markdown rendering → Markdown files: writes Markdown (evidence: `src/confluence2md/renderer.py`)
- Python API → Config loading: exports API (evidence: `src/confluence2md/__init__.py`)
- Python API → Page selection: exports API (evidence: `src/confluence2md/__init__.py`)
- Python API → Markdown rendering: exports API (evidence: `src/confluence2md/__init__.py`)
- Python API → Space discovery: exports API (evidence: `src/confluence2md/__init__.py`)
