# syswraith/elanor architecture

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

- Interactive diagram: https://gitdiagram.com/syswraith/elanor
- Repository: https://github.com/syswraith/elanor

## Overview

##### Project type and purpose
- Elanor is a minimalistic, Python-based static site generator.
- It reads Markdown files and transforms them into HTML pages using a classless CSS template and theme definitions.

##### File-structure analysis
- Top-level
- main.py – CLI entry point and orchestrator
- requirements.txt – Python dependencies (e.g., Markdown parser, Pygments)
- assets/
- config.json & config.py – site configuration and override hooks
- template.html – HTML skeleton for every page
- themes.json – style definitions per theme
- content/ – source Markdown files (.md)
- generated/ – output HTML and CSS (pygments.css)
- .github/workflows/deploy.yml – CI/CD pipeline for GitHub Pages

##### Key components
a. CLI & Orchestrator (main.py)
b. Configuration Loader (config.py + config.json)
c. Content Reader (file-system watcher/loader for content/)
d. Markdown Parser (third-party library)
e. Template Engine (injects parsed HTML into template.html)
f. Theme Manager (reads themes.json, selects CSS rules)
g. Syntax Highlighter (Pygments → pygments.css)
h. Output Writer (writes to generated/)
i. Deployment Pipeline (GitHub Actions → GitHub Pages)

##### Relationships and data flow
1. User runs main.py (CLI)
2. Orchestrator loads site config via Configuration Loader
3. Content Reader scans content/*.md
4. For each file:
– Feed Markdown to Markdown Parser → HTML fragment
– Pass fragment + front-matter into Template Engine → full HTML page
– Apply Theme Manager to choose CSS rules; link to pygments.css from Syntax Highlighter
– Output Writer writes .html into generated/
5. Deployment Pipeline picks up generated/ and publishes to GitHub Pages

##### Architectural patterns and design principles
- Pipeline pattern: discrete stages (read → parse → render → write)
- Single-process, modular design: each component is a clear, replaceable module
- Extensibility via config.json, config.py hooks, and pluggable templates/themes

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Elanor Static Site Generator"
        direction TB
        CLI["CLI & Orchestrator\n(main.py)"]:::internal
        ConfigLoader["Configuration Loader\n(config.json + config.py)"]:::internal
        ContentReader["Content Reader\n(content/*.md)"]:::io
        MarkdownParser["Markdown Parser\n(external library)"]:::external
        TemplateEngine["Template Engine\n(template.html)"]:::internal
        ThemeManager["Theme Manager\nthemes.json"]:::internal
        SyntaxHighlighter["Syntax Highlighter\n(pygments.css)"]:::external
        OutputWriter["Output Writer\n(generated/*.html)"]:::io
    end

    DeploymentPipeline["Deployment Pipeline\n(GitHub Actions → GitHub Pages)"]:::external

    CLI -->|"load config"| ConfigLoader
    CLI -->|"scan content"| ContentReader
    ContentReader -->|"markdown files"| MarkdownParser
    MarkdownParser -->|"HTML fragments"| TemplateEngine
    ConfigLoader -->|"site configuration"| TemplateEngine
    ThemeManager -->|"CSS rules"| TemplateEngine
    SyntaxHighlighter -->|"highlight CSS"| TemplateEngine
    TemplateEngine -->|"rendered HTML"| OutputWriter
    OutputWriter -->|"publish site"| DeploymentPipeline

    click CLI "https://github.com/syswraith/elanor/blob/main/main.py"
    click ConfigLoader "https://github.com/syswraith/elanor/blob/main/assets/config.json"
    click ConfigLoader "https://github.com/syswraith/elanor/blob/main/assets/config.py"
    click ContentReader "https://github.com/syswraith/elanor/tree/main/content/"
    click MarkdownParser "https://github.com/syswraith/elanor/blob/main/requirements.txt"
    click TemplateEngine "https://github.com/syswraith/elanor/blob/main/assets/template.html"
    click ThemeManager "https://github.com/syswraith/elanor/blob/main/assets/themes.json"
    click SyntaxHighlighter "https://github.com/syswraith/elanor/blob/main/generated/pygments.css"
    click OutputWriter "https://github.com/syswraith/elanor/tree/main/generated/"
    click DeploymentPipeline "https://github.com/syswraith/elanor/blob/main/.github/workflows/deploy.yml"

    %% Legend
    subgraph Legend
        direction TB
        A["Internal Module"]:::internal
        B["File I/O"]:::io
        C["External Dependency"]:::external
    end

    classDef internal fill:#D0E8FF,stroke:#084B8A,color:#084B8A,stroke-width:2px;
    classDef io fill:#E0FFD8,stroke:#1A7F37,color:#1A7F37,stroke-width:2px;
    classDef external fill:#FFE5B4,stroke:#B85C00,color:#B85C00,stroke-width:2px;
```
