# jackyzha0/quartz architecture

> Architecture diagram of the GitHub repository jackyzha0/quartz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jackyzha0/quartz
- Repository: https://github.com/jackyzha0/quartz

## Overview

##### Main System Components

a) Content Processing Layer
- Content input flow starting with Markdown files
- Processors in `quartz/processors/`:
- Parser
- Filter
- Emit processors

b) Plugin System
Create three distinct plugin sections:
- Transformers (for content transformation)
- Filters (for content filtering)
- Emitters (for output generation)

c) Component Layer
- React-based component system
- Core components like Graph, Search, Explorer
- How components connect to the content processing pipeline

##### Key Architectural Patterns to Highlight

a) Pipeline Architecture
- Content flows through: Parse → Filter → Transform → Emit

b) Plugin System
- Plugin extensibility points
- How plugins hook into the main pipeline

c) Component Architecture
- Component hierarchy
- Shared resources and styles

##### Input Layer
- Content directory
- Configuration files
- i18n support

##### Processing Core
- Main processor pipeline
- Plugin system integration points
- Resource management

##### Output Layer
- Static site generation
- Asset management
- Final HTML/CSS/JS bundle

##### Important Relationships

- Content processors and plugins
- Component system and resource management
- i18n system and content processing
- Static assets and final output

##### Technical Details

- Technologies:
- TypeScript/React for components
- Markdown processing pipeline
- SCSS for styling
- Build system integration

This architecture should emphasize Quartz's nature as a modular, extensible static site generator with a focus on digital garden publishing.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Processing Component]:::core
        L2[Plugin]:::plugin
        L3([Component]):::component
        L4[[Resource]]:::resource
    end

    subgraph "Input Layer"
        MD[Markdown Files]:::resource
        CFG[Configuration]:::resource
        click CFG "https://github.com/jackyzha0/quartz/blob/v4/quartz/cfg.ts"
    end

    subgraph "Content Processing Layer"
        Parser[Parser]:::core
        Filter[Filter]:::core
        Emit[Emit]:::core
        click Parser "https://github.com/jackyzha0/quartz/blob/v4/quartz/processors/parse.ts"
        click Filter "https://github.com/jackyzha0/quartz/blob/v4/quartz/processors/filter.ts"
        click Emit "https://github.com/jackyzha0/quartz/blob/v4/quartz/processors/emit.ts"
    end

    subgraph "Plugin System"
        direction TB
        Transformers[Transformers]:::plugin
        Filters[Filters]:::plugin
        Emitters[Emitters]:::plugin
        click Transformers "https://github.com/jackyzha0/quartz/tree/v4/quartz/plugins/transformers/"
        click Filters "https://github.com/jackyzha0/quartz/tree/v4/quartz/plugins/filters/"
        click Emitters "https://github.com/jackyzha0/quartz/tree/v4/quartz/plugins/emitters/"
    end

    subgraph "Component Layer"
        Graph([Graph]):::component
        Search([Search]):::component
        Explorer([Explorer]):::component
        Pages([Page Components]):::component
        Scripts[[Component Scripts]]:::resource
        Styles[[Component Styles]]:::resource
        click Graph "https://github.com/jackyzha0/quartz/blob/v4/quartz/components/Graph.tsx"
        click Search "https://github.com/jackyzha0/quartz/blob/v4/quartz/components/Search.tsx"
        click Explorer "https://github.com/jackyzha0/quartz/blob/v4/quartz/components/Explorer.tsx"
        click Pages "https://github.com/jackyzha0/quartz/tree/v4/quartz/components/pages/"
        click Scripts "https://github.com/jackyzha0/quartz/tree/v4/quartz/components/scripts/"
        click Styles "https://github.com/jackyzha0/quartz/tree/v4/quartz/components/styles/"
    end

    subgraph "Supporting Systems"
        i18n[[i18n System]]:::resource
        StaticAssets[[Static Assets]]:::resource
        BaseStyles[[Base Styles]]:::resource
        BuildSystem[Build System]:::core
        click i18n "https://github.com/jackyzha0/quartz/tree/v4/quartz/i18n/"
        click StaticAssets "https://github.com/jackyzha0/quartz/tree/v4/quartz/static/"
        click BaseStyles "https://github.com/jackyzha0/quartz/tree/v4/quartz/styles/"
        click BuildSystem "https://github.com/jackyzha0/quartz/blob/v4/quartz/build.ts"
    end

    subgraph "Core Utilities"
        PathUtil[Path Handler]:::core
        ResourceMgr[Resource Manager]:::core
        ContextMgr[Context Manager]:::core
        PerfMon[Performance Monitor]:::core
        click PathUtil "https://github.com/jackyzha0/quartz/blob/v4/quartz/util/path.ts"
        click ResourceMgr "https://github.com/jackyzha0/quartz/blob/v4/quartz/util/resources.tsx"
        click ContextMgr "https://github.com/jackyzha0/quartz/blob/v4/quartz/util/ctx.ts"
        click PerfMon "https://github.com/jackyzha0/quartz/blob/v4/quartz/util/perf.ts"
    end

    MD --> Parser
    Parser --> Filter
    Filter --> Emit

    Transformers --> Parser
    Filters --> Filter
    Emitters --> Emit

    CFG --> BuildSystem
    i18n --> Parser
    StaticAssets --> Emit
    BaseStyles --> Emit

    Parser --> ResourceMgr
    Filter --> ResourceMgr
    Emit --> ResourceMgr

    ResourceMgr --> Graph
    ResourceMgr --> Search
    ResourceMgr --> Explorer
    ResourceMgr --> Pages

    Scripts --> Pages
    Styles --> Pages

    classDef core fill:#4a9eff,stroke:#333,stroke-width:2px
    classDef plugin fill:#50C878,stroke:#333,stroke-width:2px
    classDef component fill:#FFA500,stroke:#333,stroke-width:2px
    classDef resource fill:#808080,stroke:#333,stroke-width:2px
```
