# msm74588/jotpad architecture

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

- Interactive diagram: https://gitdiagram.com/msm74588/jotpad
- Repository: https://github.com/msm74588/jotpad

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) User Interface Layer:
- Main Editor Window (main.py)
- Code Block Component (codeblock.py)
- Dark Mode System (dark_mode_util.py)

b) Core Features:
- Syntax Highlighting Engine (languages.py)
- File Management System

c) Resource Management:
- Language Definitions

**┌─ Presentation Layer ─────────────────────┐**
- Main Window (Tkinter-based)              │
- ┌─ Editor Components ──────────────────┐ │
- Code Block                        │ │
- Dark Mode Toggle                  │ │
- Syntax Highlighting Display       │ │
- ┘ │
- ┘
- ↕ (Data Flow)
**┌─ Core Services Layer ───────────────────┐**
- ┌─ Language Service ─┐ ┌─ Theme Engine ┐│
- Syntax Rules    │ │ - Parser      ││
- Lexer Mapping   │ │ - Schemes     ││
- ┘ └───────────────┘│
- ┘
- ↕ (File I/O)
**┌─ Resource Layer ──────────────────────────┐**
- Ayu Dark     │ │ - Syntax Rules  │  │
- Ayu Light    │ │ - Highlighting  │  │
- Monokai      │ │    Patterns     │  │
- ┘ └────────────────┘  │
- ┘

##### Important Implementation Details to Highlight

- Tkinter-based UI framework
- Syntax highlighting engine's connection to both UI and resources
- Dark mode toggle system's influence on the UI

Planned features from the TODO list:
- Markdown viewer/editor
- File tree view
- Git integration
- WebSocket-based code sharing

##### Technical Stack Indicators

Technology badges for:
- Python 3.x
- Tkinter
- Custom syntax highlighting engine
- NSIS (for Windows installer)

##### Component Interaction Flows

- File opening/saving operations
- Syntax highlighting process flow
- Theme switching mechanism
- Dark mode toggle effect

This structure reflects both the current state of the project and its planned evolution according to the TODO list, while maintaining clarity about which components are currently implemented versus planned for future development.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef resource fill:#e67e22,stroke:#d35400,color:white
    classDef future stroke-dasharray: 5 5
    classDef stack fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Main Layers
    subgraph PresentationLayer["Presentation Layer"]
        MainWindow["Main Editor Window"]:::ui
        subgraph EditorComponents["Editor Components"]
            CodeBlock["Code Block"]:::ui
            DarkMode["Dark Mode Toggle"]:::ui
            SyntaxDisplay["Syntax Highlighting Display"]:::ui
        end
    end

    subgraph CoreLayer["Core Services Layer"]
        subgraph LanguageService["Language Service"]
            SyntaxEngine["Syntax Highlighting Engine"]:::core
            LexerMap["Lexer Mapping"]:::core
        end
        subgraph ThemeEngine["Theme Engine"]
            SchemeManager["Color Scheme Management"]:::core
            ThemeParser["Theme Parser"]:::core
        end
    end

    subgraph ResourceLayer["Resource Layer"]
        subgraph ColorSchemes["Color Schemes"]
            AyuDark["Ayu Dark"]:::resource
            AyuLight["Ayu Light"]:::resource
            Monokai["Monokai"]:::resource
        end
        subgraph LangDefs["Language Definitions"]
            SyntaxRules["Syntax Rules"]:::resource
            HighlightPatterns["Highlighting Patterns"]:::resource
        end
    end

    subgraph FuturePlans["Future Features"]
        MarkdownEditor["Markdown Editor"]:::future
        FileTree["File Tree View"]:::future
        GitIntegration["Git Integration"]:::future
        CodeSharing["WebSocket Code Sharing"]:::future
    end

    subgraph BuildSystem["Build & Deployment"]
        GithubActions["GitHub Actions"]:::stack
        NSISInstaller["NSIS Installer"]:::stack
    end

    %% Relationships
    MainWindow --> CodeBlock
    MainWindow --> DarkMode
    MainWindow --> SyntaxDisplay
    CodeBlock --> SyntaxEngine
    SyntaxEngine --> LexerMap
    SyntaxEngine --> SyntaxRules
    DarkMode --> SchemeManager
    SchemeManager --> ThemeParser
    ThemeParser --> ColorSchemes
    SyntaxDisplay --> HighlightPatterns

    %% Click Events
    click MainWindow "https://github.com/MSM74588/JotPad/blob/msm74588/main/main.py"
    click CodeBlock "https://github.com/MSM74588/JotPad/blob/msm74588/main/components/codeblock.py"
    click DarkMode "https://github.com/MSM74588/JotPad/blob/msm74588/main/dark_mode_util.py"
    click SyntaxEngine "https://github.com/MSM74588/JotPad/blob/msm74588/main/components/languages.py"
    click SchemeManager "https://github.com/MSM74588/JotPad/blob/msm74588/main/components/schemeparser.py"
    click ColorSchemes "https://github.com/MSM74588/JotPad/tree/msm74588/main/components/colorschemes/"
    click AyuDark "https://github.com/MSM74588/JotPad/blob/msm74588/main/components/colorschemes/ayu-dark.toml"
    click AyuLight "https://github.com/MSM74588/JotPad/blob/msm74588/main/components/colorschemes/ayu-light.toml"
    click Monokai "https://github.com/MSM74588/JotPad/blob/msm74588/main/components/colorschemes/monokai.toml"
    click GithubActions "https://github.com/MSM74588/JotPad/blob/msm74588/main/.github/workflows/build.yml"
    click NSISInstaller "https://github.com/MSM74588/JotPad/blob/msm74588/main/install_script.nsi"
```
