# kingthorin/neonmarker architecture

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

- Interactive diagram: https://gitdiagram.com/kingthorin/neonmarker
- Repository: https://github.com/kingthorin/neonmarker

## Overview

##### Project type and purpose
- This is a Java-based plugin (add-on) for the OWASP ZAP proxy.

##### File structure
- src/main/java/org/zaproxy/zap/extension/neonmarker
– ExtensionNeonmarker.java: the entry point that hooks into ZAP.
– PopupMenuHistoryNeonmarker.java & PopupMenuItem…: menu items added to the History context menu.
- src/main/resources/org/zaproxy/zap/extension/neonmarker/resources
– Messages.properties: UI strings.
- src/main/javahelp/help: the built-in help set for the extension.
- Gradle build scripts and GitHub Actions workflows for CI and releases.

##### README insights
- Describes the addon’s function: colorizing History entries by tag.
- Points to help documentation within ZAP and online.

##### Main components
a. ZAP Core
– Extension Loader / Plugin Manager
– History Table module (the UI table of requests/responses)
– ZAP Preferences / Configuration API
b. Neonmarker Extension
– ExtensionNeonmarker (bootstrap, hook registration)
– UI Panel (NeonmarkerPanel) for rule editing
– Popup Menu Providers (PopupMenuHistoryNeonmarker, PopupMenuItemHistoryColor, PopupMenuItemHistoryUntag)
– Help Component (JavaHelp integration)
c. Resources & Build
– Messages.properties
– Help set files
– Build Scripts & CI workflows

##### Relationships & data flows
- Extension Loader → instantiates ExtensionNeonmarker at startup.
- ExtensionNeonmarker → registers:
– a UI Panel in ZAP’s tabbed interface
– popup menu items in History context menu
- When the History Table renders:
- Help menu → loads content from JavaHelp resource files.

##### Architectural patterns & design principles
- Plugin/extension pattern: loose coupling between ZAP core and this addon.
- Observer pattern: listening to History Table events to trigger recoloring.
- MVC-lite:
– View: NeonmarkerPanel and popup menu UIs
– Controller: ExtensionNeonmarker wiring components together

##### Technologies & frameworks
- Java 8+
- Gradle (Kotlin DSL) for build
- Swing (for UI panel and popup menus)
- JavaHelp API
- OWASP ZAP extension APIs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% ZAP Core Components
    subgraph "ZAP Core" 
        direction TB
        ZLdr["Extension Loader / Plugin Manager"]:::core
        HistTbl["History Table Module"]:::core
        PrefAPI["ZAP Preferences / Configuration API"]:::core
        ZHelp["ZAP Help Menu"]:::core
    end

    %% Neonmarker Extension Components
    subgraph "Neonmarker Extension" 
        direction TB
        EN["ExtensionNeonmarker"]:::extension
        subgraph "UI Components"
            direction TB
            NP["NeonmarkerPanel"]:::extension
            subgraph "Popup Menu Components"
                direction TB
                PMH["PopupMenuHistoryNeonmarker"]:::extension
                PMC["PopupMenuItemHistoryColor"]:::extension
                PMU["PopupMenuItemHistoryUntag"]:::extension
            end
        end
        CE["Color Engine & History Listener"]:::extension
        JH["JavaHelp Integration"]:::extension
    end

    %% Resources & Build
    subgraph "Resources & Build" 
        direction TB
        MSG["Messages.properties"]:::resource
        subgraph "HelpSet Files"
            direction TB
            HSHS["helpset.hs"]:::resource
            HSContents["contents/intro.html, index.xml, toc.xml, map.jhm, images/"]:::resource
        end
        subgraph "Build & CI"
            direction TB
            GRADLE["build.gradle.kts, settings.gradle.kts, gradle.properties"]:::resource
            CIWF[".github/workflows/*.yml"]:::resource
        end
    end

    %% Connections
    ZLdr -->|"instantiates at startup"| EN
    EN -->|"registers hook"| NP
    EN -->|"registers hook"| PMH
    EN -->|"registers hook"| PMC
    EN -->|"registers hook"| PMU
    EN -->|"listens to events"| CE
    HistTbl -->|"on render calls"| CE
    CE -->|"renders color"| HistTbl
    NP -->|"reads/writes prefs"| PrefAPI
    EN -->|"registers help"| JH
    JH -->|"loads content from"| HSHS
    JMSG --> MSG
    MSG -.-> NP
    MSG -.-> PMH
    MSG -.-> PMC
    MSG -.-> PMU

    %% Resource links
    EN --> MSG
    JH --> HSContents
    GRADLE --- CIWF

    %% Click Events
    click EN "https://github.com/kingthorin/neonmarker/blob/main/src/main/java/org/zaproxy/zap/extension/neonmarker/ExtensionNeonmarker.java"
    click NP "https://github.com/kingthorin/neonmarker/blob/main/src/main/java/org/zaproxy/zap/extension/neonmarker/NeonmarkerPanel.java"
    click PMH "https://github.com/kingthorin/neonmarker/blob/main/src/main/java/org/zaproxy/zap/extension/neonmarker/PopupMenuHistoryNeonmarker.java"
    click PMC "https://github.com/kingthorin/neonmarker/blob/main/src/main/java/org/zaproxy/zap/extension/neonmarker/PopupMenuItemHistoryColor.java"
    click PMU "https://github.com/kingthorin/neonmarker/blob/main/src/main/java/org/zaproxy/zap/extension/neonmarker/PopupMenuItemHistoryUntag.java"
    click MSG "https://github.com/kingthorin/neonmarker/blob/main/src/main/resources/org/zaproxy/zap/extension/neonmarker/resources/Messages.properties"
    click HSHS "https://github.com/kingthorin/neonmarker/blob/main/src/main/javahelp/help/helpset.hs"
    click HSContents "https://github.com/kingthorin/neonmarker/blob/main/src/main/javahelp/help/contents/intro.html"
    click HSContents "https://github.com/kingthorin/neonmarker/blob/main/src/main/javahelp/help/index.xml"
    click HSContents "https://github.com/kingthorin/neonmarker/blob/main/src/main/javahelp/help/toc.xml"
    click HSContents "https://github.com/kingthorin/neonmarker/blob/main/src/main/javahelp/help/map.jhm"
    click HSContents "https://github.com/kingthorin/neonmarker/tree/main/src/main/javahelp/help/contents/images"
    click GRADLE "https://github.com/kingthorin/neonmarker/blob/main/build.gradle.kts"
    click CIWF "https://github.com/kingthorin/neonmarker/blob/main/.github/workflows/ci.yml"
    click CIWF "https://github.com/kingthorin/neonmarker/blob/main/.github/workflows/codeql-analysis.yml"
    click CIWF "https://github.com/kingthorin/neonmarker/blob/main/.github/workflows/prepare-release.yml"
    click CIWF "https://github.com/kingthorin/neonmarker/blob/main/.github/workflows/release.yml"

    %% Styles
    classDef core fill:#cccccc,stroke:#333,stroke-width:1px
    classDef extension fill:#aaffaa,stroke:#333,stroke-width:1px
    classDef resource fill:#aaddff,stroke:#333,stroke-width:1px
```
