# kristaps-zakis/python-static-site-generation architecture

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

- Interactive diagram: https://gitdiagram.com/kristaps-zakis/python-static-site-generation
- Repository: https://github.com/kristaps-zakis/python-static-site-generation

## Overview

##### Main Components

A. Input Layer:
- Content Directory (Markdown Files)
- Template System (template.html)
- Static Assets (CSS and images)

B. Processing Core:
- Markdown Parser Components
- HTML Generation System
- Text Processing Units

C. Output Layer:
- Generated HTML Pages
- Compiled Static Assets

##### Component Relationships and Structure

**[Content Layer]**

- ▼
**[Processing Layer]**

- ▼
**[Output Layer]**

##### Detailed Component Breakdown

A. Content Layer (Input):
- Markdown files (content/*.md)
- Template files (template.html)
- Static assets (static/*)

B. Processing Layer (Core):
- TextNode Processor (textnode.py)
- HTML Node Generator (htmlnode.py)
- Markdown Parser
- Inline Markdown Processor (inline_markdown.py)
- Block Markdown Processor (markdown_blocks.py)
- Title Extractor (extract_title.py)
- Page Generator (generate_page.py)

C. Output Layer:
- Generated HTML files
- Copied static assets

##### Key Architectural Patterns to Highlight

- Pipeline Pattern: Show the flow from markdown to HTML
- Component-based Architecture: Separate modules for different responsibilities
- Template System Integration
- Static Asset Management

##### Implementation Details

- The separation between content and presentation
- The markdown processing pipeline
- The template system's role
- Static asset handling
- Test coverage (show relationship with test files)

##### In the Processing layer, show the markdown processing pipeline
- [TextNode] → [HTMLNode] → [Markdown Blocks] → [Inline Markdown] → [Page Generator]

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef input fill:#a8d1f0,stroke:#333
    classDef processing fill:#98e698,stroke:#333
    classDef output fill:#ffb366,stroke:#333
    classDef test fill:#e6b3ff,stroke:#333

    %% Input Layer
    subgraph Input
        Content["Content Directory"]
        Template["Template System"]
        StaticAssets["Static Assets"]
        CSS["CSS Styling"]
    end

    %% Processing Layer
    subgraph Processing
        TextNode["TextNode Processor"]
        HTMLNode["HTML Node Generator"]
        InlineMD["Inline Markdown Processor"]
        BlockMD["Block Markdown Processor"]
        TitleExt["Title Extractor"]
        PageGen["Page Generator"]
        MainEntry["Main Entry Point"]
    end

    %% Testing Layer
    subgraph Testing
        TestTitle["Title Extractor Tests"]
        TestHTML["HTMLNode Tests"]
        TestInline["Inline Markdown Tests"]
        TestBlock["Block Markdown Tests"]
        TestText["TextNode Tests"]
    end

    %% Output Layer
    subgraph Output
        GenHTML["Generated HTML"]
        CompiledAssets["Compiled Static Assets"]
    end

    %% Build and Scripts
    BuildScript["Build Script"]
    TestRunner["Test Runner"]

    %% Relationships
    Content --> TextNode
    Template --> PageGen
    StaticAssets --> CompiledAssets
    CSS --> CompiledAssets

    TextNode --> HTMLNode
    HTMLNode --> InlineMD
    InlineMD --> BlockMD
    BlockMD --> TitleExt
    TitleExt --> PageGen
    PageGen --> GenHTML

    MainEntry --> PageGen

    BuildScript --> MainEntry
    TestRunner --> Testing

    TestTitle -.-> TitleExt
    TestHTML -.-> HTMLNode
    TestInline -.-> InlineMD
    TestBlock -.-> BlockMD
    TestText -.-> TextNode

    %% Click events for component mapping
    click Content "https://github.com/kristaps-zakis/python-static-site-generation/tree/main/content"
    click Template "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/template.html"
    click StaticAssets "https://github.com/kristaps-zakis/python-static-site-generation/tree/main/static"
    click CSS "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/static/index.css"
    click TextNode "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/textnode.py"
    click HTMLNode "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/htmlnode.py"
    click InlineMD "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/inline_markdown.py"
    click BlockMD "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/markdown_blocks.py"
    click TitleExt "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/extract_title.py"
    click PageGen "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/generate_page.py"
    click MainEntry "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/main.py"
    click BuildScript "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/main.sh"
    click TestRunner "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/test.sh"
    click TestTitle "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/test_extract_title.py"
    click TestHTML "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/test_htmlnode.py"
    click TestInline "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/test_inline_markdown.py"
    click TestBlock "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/test_markdown_blocks.py"
    click TestText "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/src/test_textnode.py"
    click GenHTML "https://github.com/kristaps-zakis/python-static-site-generation/blob/main/index.html"

    %% Style applications
    class Content,Template,StaticAssets,CSS input
    class TextNode,HTMLNode,InlineMD,BlockMD,TitleExt,PageGen,MainEntry processing
    class GenHTML,CompiledAssets output
    class TestTitle,TestHTML,TestInline,TestBlock,TestText test
```
