# pngwn/mdsvex architecture

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

- Interactive diagram: https://gitdiagram.com/pngwn/mdsvex
- Repository: https://github.com/pngwn/mdsvex

## Overview

##### Main Components

a) Core Processing Layer:
- mdsvex (central package)
- svelte-parse (parser)
- svast (AST specification)
- svast-stringify (AST to component converter)
- svast-utils (AST utilities)

b) Documentation Layer:
- site (documentation website)

**┌─────────────────────────────────────────────────────┐**
- Client Layer                       │
- ┤

- Documentation Site                    │

- ┬─────────────────────────────────┘

**┌───────────────────▼─────────────────────────────────┐**
- MDsveX Core                         │
- ┌──────────────────────────────────────────────┐  │
- mdsvex package                  │  │
- ┘  │

- ┌──────────┐ ┌─────▼────────┐ ┌──────────────┐  │
- svast   │ │svelte-parse  │ │svast-stringify│  │
- ┬─────┘ └─────────────┘  └───────▲───────┘  │

- ► svast-utils ──────┘          │  │
- ┘

##### Component Relationships
- mdsvex as the central component
- svelte-parse feeding into mdsvex
- svast defining the structure used by other components
- svast-stringify consuming the AST to produce output
- svast-utils providing support to other components

##### Additional Elements
Include:
- Version information for major components
- Data flow direction indicators
- Input/Output formats (Markdown → Svelte)

##### Implementation Details
- Markdown processing pipeline
- AST transformation stages
- Integration points with Svelte
- Documentation site architecture

##### Key Features to Highlight
- Markdown preprocessing capabilities
- Svelte component integration
- AST manipulation and transformation
- Documentation and examples system

- The overall system architecture
- Component dependencies and relationships
- Data flow through the system
- Integration points and extensibility options

Remember to maintain a balance between detail and clarity, focusing on the architectural relationships while avoiding overwhelming implementation details.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef parser fill:#2ecc71,stroke:#27ae60,color:white
    classDef ast fill:#e74c3c,stroke:#c0392b,color:white
    classDef utils fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef docs fill:#9b59b6,stroke:#8e44ad,color:white
    classDef legend fill:none,stroke:#666,color:#666

    %% Client Layer
    subgraph ClientLayer
        DocSite["Documentation Site"]
    end

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Layer"]
        MDsveX["MDsveX Core Package"]
        SvelteParse["Svelte Parser"]
        Svast["SVAST Specification"]
        SvastStringify["SVAST Stringify"]
        SvastUtils["SVAST Utilities"]
    end

    %% Relationships
    DocSite --> MDsveX
    MDsveX --> SvelteParse
    SvelteParse --> Svast
    Svast --> SvastStringify
    Svast --> SvastUtils
    SvastUtils --> SvastStringify
    SvastUtils --> MDsveX

    %% Click Events
    click MDsveX "https://github.com/pngwn/MDsveX/tree/main/packages/mdsvex/src/"
    click SvelteParse "https://github.com/pngwn/MDsveX/tree/main/packages/svelte-parse/src/"
    click Svast "https://github.com/pngwn/MDsveX/tree/main/packages/svast/"
    click SvastStringify "https://github.com/pngwn/MDsveX/tree/main/packages/svast-stringify/src/"
    click SvastUtils "https://github.com/pngwn/MDsveX/tree/main/packages/svast-utils/src/"
    click DocSite "https://github.com/pngwn/MDsveX/tree/main/packages/site/"

    %% Legend
    subgraph Legend
        L1["Core Component"]:::core
        L2["Parser Component"]:::parser
        L3["AST Component"]:::ast
        L4["Utility Component"]:::utils
        L5["Documentation"]:::docs
    end

    %% Styling
    class MDsveX core
    class SvelteParse parser
    class Svast ast
    class SvastStringify ast
    class SvastUtils utils
    class DocSite docs
```
