# jackwener/wechat-article-to-markdown architecture

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

- Interactive diagram: https://gitdiagram.com/jackwener/wechat-article-to-markdown
- Repository: https://github.com/jackwener/wechat-article-to-markdown

## Overview

This is a small CLI utility: a user supplies a WeChat article URL, which is normalized and fetched in a Camoufox browser; article metadata and content are extracted, converted to Markdown, and saved with locally downloaded images. The main runtime is concentrated in one module, so several stages share its source path. Some orchestration calls fall in omitted excerpt sections; those links are marked unverified rather than asserted as inspected.

Main entry points: [`wechat_article_to_markdown.py`](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py) (Article fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fetch["Input and Fetch"]
  node_cli["CLI entry"]
  node_url["URL normalization"]
  node_fetcher["Article fetch"]
  node_camoufox["Camoufox browser"]
end

subgraph group_transform["Article Processing"]
  node_html["HTML parsing"]
  node_metadata["Metadata extraction"]
  node_content["Content preparation"]
  node_markdown["Markdown conversion"]
end

subgraph group_output["Local Output"]
  node_images["Image downloading"]
  node_imagefiles[("Image files")]
  node_rewrite["Image link rewrite"]
  node_assembly["Markdown assembly"]
  node_markdownfile["Markdown file"]
end

node_user(("User"))
node_wechat["WeChat article"]

node_user -->|"provides URL"| node_cli
node_cli -->|"normalizes"| node_url
node_cli -->|"runs fetch"| node_fetcher
node_fetcher -->|"opens browser"| node_camoufox
node_camoufox -->|"loads article"| node_wechat
node_fetcher -.->|"parses page"| node_html
node_html -.->|"extracts fields"| node_metadata
node_html -.->|"prepares body"| node_content
node_content -.->|"converts HTML"| node_markdown
node_fetcher -.->|"downloads images"| node_images
node_images -->|"writes images"| node_imagefiles
node_markdown -.->|"rewrites links"| node_rewrite
node_rewrite -.->|"provides body"| node_assembly
node_metadata -.->|"provides fields"| node_assembly
node_assembly -.->|"writes Markdown"| node_markdownfile

click node_cli "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_url "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_fetcher "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_html "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_metadata "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_content "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_markdown "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_images "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_rewrite "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py"
click node_assembly "https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.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_url,node_fetcher,node_camoufox,node_user toneBlue
class node_html,node_metadata,node_content,node_markdown toneAmber
class node_images,node_imagefiles,node_rewrite,node_assembly,node_markdownfile toneMint
class node_wechat toneIndigo
```

## Components

### Input and Fetch

- [CLI entry](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- [URL normalization](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- [Article fetch](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- **Camoufox browser**

### Article Processing

- [HTML parsing](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- [Metadata extraction](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- [Content preparation](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- [Markdown conversion](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`

### Local Output

- [Image downloading](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- **Image files**
- [Image link rewrite](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- [Markdown assembly](https://github.com/jackwener/wechat-article-to-markdown/blob/main/wechat_article_to_markdown.py): `wechat_article_to_markdown.py`
- **Markdown file**

### Other components

- **User**
- **WeChat article**

## Connections

- User → CLI entry: provides URL (evidence: `README.md`)
- CLI entry → URL normalization: normalizes (evidence: `wechat_article_to_markdown.py`)
- CLI entry → Article fetch: runs fetch (evidence: `wechat_article_to_markdown.py`)
- Article fetch → Camoufox browser: opens browser (evidence: `wechat_article_to_markdown.py`)
- Camoufox browser → WeChat article: loads article
- Article fetch → HTML parsing: parses page (evidence: `wechat_article_to_markdown.py`)
- HTML parsing → Metadata extraction: extracts fields (evidence: `wechat_article_to_markdown.py`)
- HTML parsing → Content preparation: prepares body (evidence: `wechat_article_to_markdown.py`)
- Content preparation → Markdown conversion: converts HTML (evidence: `wechat_article_to_markdown.py`)
- Article fetch → Image downloading: downloads images (evidence: `wechat_article_to_markdown.py`)
- Image downloading → Image files: writes images (evidence: `wechat_article_to_markdown.py`)
- Markdown conversion → Image link rewrite: rewrites links (evidence: `wechat_article_to_markdown.py`)
- Image link rewrite → Markdown assembly: provides body (evidence: `wechat_article_to_markdown.py`)
- Metadata extraction → Markdown assembly: provides fields (evidence: `wechat_article_to_markdown.py`)
- Markdown assembly → Markdown file: writes Markdown
