# chen017/blog architecture

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

- Interactive diagram: https://gitdiagram.com/chen017/blog
- Repository: https://github.com/chen017/blog

## Overview

This repository is a CMS-integrated Astro static blog template. Its user-facing flow is configured Markdown/MDX content rendered with blog-specific directives and media handling, then presented through navigation, search, sidebar widgets, and music controls; it also generates feeds and social preview images. The README highlights music cards, media lazy loading, and customized link/skill cards. Some page and utility implementations were not sampled, so their internal call relationships are omitted; configuration explicitly wires the Markdown plugins.

Main entry points: [`astro.config.mjs`](https://github.com/chen017/blog/blob/main/astro.config.mjs) (Astro Markdown pipeline), [`src/utils/widget.ts`](https://github.com/chen017/blog/blob/main/src/utils/widget.ts) (Sidebar widgets), [`src/config.ts`](https://github.com/chen017/blog/blob/main/src/config.ts) (Blog configuration), [`src/utils/content.ts`](https://github.com/chen017/blog/blob/main/src/utils/content.ts) (Content utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Content rendering"]
  node_astro["Astro Markdown pipeline<br/>[astro.config.mjs]"]
  node_directives["Directive conversion"]
  node_admonition["Admonition cards"]
  node_github["GitHub cards"]
  node_musiccard["Music cards"]
  node_songcard["Song cards"]
  node_lazy["Lazy media"]
  node_mermaid["Mermaid diagrams<br/>[rehype-mermaid.mjs]"]
  node_codeplugins["Code block controls<br/>[copy-button.ts]"]
end

subgraph group_site["Blog experience"]
  node_reader(("Blog reader"))
  node_search["Post search<br/>[search.svelte]"]
  node_dropdown["Search panel"]
  node_player["Music player<br/>[musicPlayer.svelte]"]
  node_widgets["Sidebar widgets<br/>[widget.ts]"]
  node_directory["Directory tree"]
  node_stats["Blog statistics<br/>[statistics.svelte]"]
  node_toc["Table of contents<br/>[toc.ts]"]
  node_links["Link presets<br/>[link-presets.ts]"]
end

subgraph group_config["Site configuration"]
  node_configfile["Blog configuration<br/>[config.ts]"]
  node_types["Configuration types<br/>[config.ts]"]
  node_wallpaper["Wallpaper behavior<br/>[wallpaper.ts]"]
  node_widgetutil["Widget behavior<br/>[widget.ts]"]
end

subgraph group_outputs["Feeds and previews"]
  node_contentutil["Content utilities<br/>[content.ts]"]
  node_atom["Atom feed<br/>[atom.xml.ts]"]
  node_rss["RSS feed<br/>[rss.xml.ts]"]
  node_og["Social preview image<br/>[&#91;...slug&#93;.png.ts]"]
end

node_author(("Content author"))

node_author -.->|"provides content"| node_astro
node_astro -->|"registers plugin"| node_directives
node_astro -->|"registers component"| node_admonition
node_astro -->|"registers component"| node_github
node_astro -->|"registers component"| node_musiccard
node_astro -->|"registers component"| node_songcard
node_astro -->|"registers plugin"| node_lazy
node_astro -->|"registers plugin"| node_mermaid
node_astro -->|"registers plugin"| node_codeplugins
node_reader -.->|"searches posts"| node_search
node_search -->|"uses panel"| node_dropdown
node_reader -.->|"controls playback"| node_player
node_reader -.->|"views sidebar"| node_widgets
node_widgets -.->|"selects component"| node_directory
node_widgets -.->|"selects component"| node_stats
node_widgets -.->|"selects component"| node_toc
node_reader -.->|"uses navigation"| node_links
node_configfile -->|"uses types"| node_types
node_configfile -->|"configures behavior"| node_wallpaper
node_configfile -->|"configures behavior"| node_widgetutil
node_atom -->|"loads posts"| node_contentutil
node_rss -->|"loads posts"| node_contentutil
node_og -.->|"loads posts"| node_contentutil

click node_astro "https://github.com/chen017/blog/blob/main/astro.config.mjs"
click node_directives "https://github.com/chen017/blog/blob/main/src/plugins/remark-directive-rehype.js"
click node_admonition "https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-admonition.mjs"
click node_github "https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-github-card.mjs"
click node_musiccard "https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-music-card.mjs"
click node_songcard "https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-song-card.mjs"
click node_lazy "https://github.com/chen017/blog/blob/main/src/plugins/rehype-lazy-load-media.mjs"
click node_mermaid "https://github.com/chen017/blog/blob/main/src/plugins/rehype-mermaid.mjs"
click node_codeplugins "https://github.com/chen017/blog/blob/main/src/plugins/expressive-code/copy-button.ts"
click node_search "https://github.com/chen017/blog/blob/main/src/components/navbar/search.svelte"
click node_dropdown "https://github.com/chen017/blog/blob/main/src/components/common/DropdownPanel.svelte"
click node_player "https://github.com/chen017/blog/blob/main/src/components/musicPlayer.svelte"
click node_widgets "https://github.com/chen017/blog/blob/main/src/utils/widget.ts"
click node_directory "https://github.com/chen017/blog/blob/main/src/components/sidebar/directoryTree.svelte"
click node_stats "https://github.com/chen017/blog/blob/main/src/components/sidebar/statistics.svelte"
click node_toc "https://github.com/chen017/blog/blob/main/src/components/sidebar/toc.ts"
click node_links "https://github.com/chen017/blog/blob/main/src/constants/link-presets.ts"
click node_configfile "https://github.com/chen017/blog/blob/main/src/config.ts"
click node_types "https://github.com/chen017/blog/blob/main/src/types/config.ts"
click node_wallpaper "https://github.com/chen017/blog/blob/main/src/utils/wallpaper.ts"
click node_widgetutil "https://github.com/chen017/blog/blob/main/src/utils/widget.ts"
click node_contentutil "https://github.com/chen017/blog/blob/main/src/utils/content.ts"
click node_atom "https://github.com/chen017/blog/blob/main/src/pages/atom.xml.ts"
click node_rss "https://github.com/chen017/blog/blob/main/src/pages/rss.xml.ts"
click node_og "https://github.com/chen017/blog/blob/main/src/pages/og/%5B...slug%5D.png.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_astro,node_directives,node_admonition,node_github,node_musiccard,node_songcard,node_lazy,node_mermaid,node_codeplugins toneBlue
class node_reader,node_search,node_dropdown,node_player,node_widgets,node_directory,node_stats,node_toc,node_links toneAmber
class node_configfile,node_types,node_wallpaper,node_widgetutil toneMint
class node_contentutil,node_atom,node_rss,node_og toneRose
class node_author toneIndigo
```

## Components

### Content rendering

- [Astro Markdown pipeline](https://github.com/chen017/blog/blob/main/astro.config.mjs): `astro.config.mjs`
- [Directive conversion](https://github.com/chen017/blog/blob/main/src/plugins/remark-directive-rehype.js): `src/plugins/remark-directive-rehype.js`
- [Admonition cards](https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-admonition.mjs): `src/plugins/rehype-component-admonition.mjs`
- [GitHub cards](https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-github-card.mjs): `src/plugins/rehype-component-github-card.mjs`
- [Music cards](https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-music-card.mjs): `src/plugins/rehype-component-music-card.mjs`
- [Song cards](https://github.com/chen017/blog/blob/main/src/plugins/rehype-component-song-card.mjs): `src/plugins/rehype-component-song-card.mjs`
- [Lazy media](https://github.com/chen017/blog/blob/main/src/plugins/rehype-lazy-load-media.mjs): `src/plugins/rehype-lazy-load-media.mjs`
- [Mermaid diagrams](https://github.com/chen017/blog/blob/main/src/plugins/rehype-mermaid.mjs): `src/plugins/rehype-mermaid.mjs`
- [Code block controls](https://github.com/chen017/blog/blob/main/src/plugins/expressive-code/copy-button.ts): `src/plugins/expressive-code/copy-button.ts`

### Blog experience

- **Blog reader**
- [Post search](https://github.com/chen017/blog/blob/main/src/components/navbar/search.svelte): `src/components/navbar/search.svelte`
- [Search panel](https://github.com/chen017/blog/blob/main/src/components/common/DropdownPanel.svelte): `src/components/common/DropdownPanel.svelte`
- [Music player](https://github.com/chen017/blog/blob/main/src/components/musicPlayer.svelte): `src/components/musicPlayer.svelte`
- [Sidebar widgets](https://github.com/chen017/blog/blob/main/src/utils/widget.ts): `src/utils/widget.ts`
- [Directory tree](https://github.com/chen017/blog/blob/main/src/components/sidebar/directoryTree.svelte): `src/components/sidebar/directoryTree.svelte`
- [Blog statistics](https://github.com/chen017/blog/blob/main/src/components/sidebar/statistics.svelte): `src/components/sidebar/statistics.svelte`
- [Table of contents](https://github.com/chen017/blog/blob/main/src/components/sidebar/toc.ts): `src/components/sidebar/toc.ts`
- [Link presets](https://github.com/chen017/blog/blob/main/src/constants/link-presets.ts): `src/constants/link-presets.ts`

### Site configuration

- [Blog configuration](https://github.com/chen017/blog/blob/main/src/config.ts): `src/config.ts`
- [Configuration types](https://github.com/chen017/blog/blob/main/src/types/config.ts): `src/types/config.ts`
- [Wallpaper behavior](https://github.com/chen017/blog/blob/main/src/utils/wallpaper.ts): `src/utils/wallpaper.ts`
- [Widget behavior](https://github.com/chen017/blog/blob/main/src/utils/widget.ts): `src/utils/widget.ts`

### Feeds and previews

- [Content utilities](https://github.com/chen017/blog/blob/main/src/utils/content.ts): `src/utils/content.ts`
- [Atom feed](https://github.com/chen017/blog/blob/main/src/pages/atom.xml.ts): `src/pages/atom.xml.ts`
- [RSS feed](https://github.com/chen017/blog/blob/main/src/pages/rss.xml.ts): `src/pages/rss.xml.ts`
- [Social preview image](https://github.com/chen017/blog/blob/main/src/pages/og/%5B...slug%5D.png.ts): `src/pages/og/[...slug].png.ts`

### Other components

- **Content author**

## Connections

- Content author → Astro Markdown pipeline: provides content
- Astro Markdown pipeline → Directive conversion: registers plugin (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → Admonition cards: registers component (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → GitHub cards: registers component (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → Music cards: registers component (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → Song cards: registers component (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → Lazy media: registers plugin (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → Mermaid diagrams: registers plugin (evidence: `astro.config.mjs`)
- Astro Markdown pipeline → Code block controls: registers plugin (evidence: `astro.config.mjs`)
- Blog reader → Post search: searches posts
- Post search → Search panel: uses panel (evidence: `src/components/navbar/search.svelte`)
- Blog reader → Music player: controls playback
- Blog reader → Sidebar widgets: views sidebar
- Sidebar widgets → Directory tree: selects component
- Sidebar widgets → Blog statistics: selects component
- Sidebar widgets → Table of contents: selects component
- Blog reader → Link presets: uses navigation
- Blog configuration → Configuration types: uses types (evidence: `src/config.ts`)
- Blog configuration → Wallpaper behavior: configures behavior (evidence: `src/utils/wallpaper.ts`)
- Blog configuration → Widget behavior: configures behavior (evidence: `src/utils/widget.ts`)
- Atom feed → Content utilities: loads posts (evidence: `src/pages/atom.xml.ts`)
- RSS feed → Content utilities: loads posts (evidence: `src/pages/rss.xml.ts`)
- Social preview image → Content utilities: loads posts
