# diagmindtw/docx architecture

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

- Interactive diagram: https://gitdiagram.com/diagmindtw/docx
- Repository: https://github.com/diagmindtw/docx

## Overview

##### Project Type & Purpose
- This is a **static‐site/documentation generator** repository, once automating DOCX→HTML/JSON conversions and publishing the results as a website (now largely deprecated in favor of the npm package “onenote2md”).
- It hosts source DOCX files, conversion scripts (Python/Node), post‐processing utilities, HTML templates, and static assets (CSS/JS) that together produce a browsable site.

##### File Structure → Architectural Components
- docxView/ and sec/
– Raw DOCX files and their pre‐generated HTML views.
– **Component: Source Documents** (green)
- genSEC.py
– Python conversion script (DOCX → HTML sections or JSON).
– **Component: Conversion Engine** (yellow)
- public/utli, public/postProcess, pat/
– Node.js utilities (nest2json.js, table.js) and PAT scripts that transform JSON to final form.
– **Component: Transformation Pipeline** (orange)
- templates/
– HTML templates (index.html, redirect.html) for injecting content.
– **Component: Templating Layer** (purple)
- index.html, master.html, public/css, public/js
– The final static site assets delivered to clients.
– **Component: Static Site Artifacts** (blue)
- .github/workflows/main.yml
– CI/CD workflow for building and deploying the site.
– **Component: Deployment Pipeline** (gray)

##### README Insights
- The README states “main branch RIP – only hosting workflow works” and points to the new npm package.
- This tells us the build/deploy pipeline is live (via GitHub Actions), but most code is now legacy.

a. Main Components & Labels
1. Source Documents (docxView/, sec/)
2. Conversion Engine (genSEC.py)
3. Transformation Pipeline (pat/, public/utli, public/postProcess)
4. Templating Layer (templates/)
5. Static Site Artifacts (public/css, public/js, index.html, master.html)
6. Deployment Pipeline (GitHub Actions)
b. Relationships & Interactions
c. Architectural Patterns & Principles
- **Pipeline Pattern**: linear transformation from raw docs to final HTML
- **Separation of Concerns**: distinct layers handle conversion, transformation, templating, and presentation
- **Static Site Architecture**: no backend runtime; all rendering occurs at build time
d. Key Technologies & Frameworks
- Python (genSEC.py) for DOCX parsing
- Node.js scripts (nest2json.js, table.js) for JSON transformations
- Simple HTML templating (static .html files with placeholders)
- GitHub Actions (main.yml) for CI/CD
- Vanilla CSS/JavaScript for client assets

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Deployment Pipeline
    subgraph "Deployment Pipeline"
        GH["GitHub Actions\n(.github/workflows/main.yml)"]:::deploy
    end

    %% Source Documents
    subgraph "Source Documents"
        DocxView["docxView/"]:::source
        Sec["sec/"]:::source
    end

    %% Conversion Engine
    subgraph "Conversion Engine"
        CE["genSEC.py"]:::conversion
    end

    %% Transformation Pipeline
    subgraph "Transformation Pipeline"
        Pat["pat/"]:::transform
        Util["public/util/"]:::transform
        PostProc["public/postProcess/"]:::transform
    end

    %% Templating Layer
    subgraph "Templating Layer"
        Temp["templates/"]:::templating
    end

    %% Static Site Artifacts
    subgraph "Static Site Artifacts"
        Index["index.html"]:::output
        Master["master.html"]:::output
        CSS["public/css/"]:::output
        JS["public/js/"]:::output
    end

    %% Hosted Site
    Hosted["Hosted Site"]

    %% Connections
    GH -->|"trigger build"| CE
    DocxView -->|".docx"| CE
    Sec -->|".docx"| CE
    CE -->|".json"| Pat
    Pat -->|".json"| Util
    Util -->|".json"| PostProc
    PostProc -->|"processed data"| Temp
    Temp -->|".html"| Index
    Temp -->|".html"| Master
    Temp -->|".css"| CSS
    Temp -->|".js"| JS
    Index -->|"deploy"| GH
    Master -->|"deploy"| GH
    CSS -->|"deploy"| GH
    JS -->|"deploy"| GH
    GH -->|"publishes"| Hosted

    %% Click Events
    click DocxView "https://github.com/diagmindtw/docx/tree/main/docxView/"
    click Sec "https://github.com/diagmindtw/docx/tree/main/sec/"
    click CE "https://github.com/diagmindtw/docx/blob/main/genSEC.py"
    click Pat "https://github.com/diagmindtw/docx/tree/main/pat/"
    click Util "https://github.com/diagmindtw/docx/tree/main/public/util/"
    click PostProc "https://github.com/diagmindtw/docx/tree/main/public/postProcess/"
    click Temp "https://github.com/diagmindtw/docx/tree/main/templates/"
    click Index "https://github.com/diagmindtw/docx/blob/main/index.html"
    click Master "https://github.com/diagmindtw/docx/blob/main/master.html"
    click CSS "https://github.com/diagmindtw/docx/tree/main/public/css/"
    click JS "https://github.com/diagmindtw/docx/tree/main/public/js/"
    click GH "https://github.com/diagmindtw/docx/blob/main/.github/workflows/main.yml"

    %% Styles
    classDef source fill:#ccffcc,stroke:#008000,stroke-width:1px
    classDef conversion fill:#ffffcc,stroke:#cccc00,stroke-width:1px
    classDef transform fill:#ffe0b3,stroke:#ff8000,stroke-width:1px
    classDef templating fill:#e2ccff,stroke:#8000ff,stroke-width:1px
    classDef output fill:#cce5ff,stroke:#0080ff,stroke-width:1px
    classDef deploy fill:#e0e0e0,stroke:#888888,stroke-width:1px
```
