# derhermann/beyondmarkdown architecture

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

- Interactive diagram: https://gitdiagram.com/derhermann/beyondmarkdown
- Repository: https://github.com/derhermann/beyondmarkdown

## Overview

##### Main Components Identification

a) Browser Components:
- Chrome Browser Environment
- D&D Beyond Website (external system)
- Extension Interface Components (popup)
- Content Script (main functionality)

##### Component Relationships

Use these specific connection types:
- Double lines: Data transformations

##### Detailed Component Descriptions

Popup Interface (popup.html, popup.js):
- Settings configuration
- Tag customization options
- Format selection (all content vs. tagged content)

Content Script (contentScript.js):
- DOM manipulation
- Markdown processing
- HTML conversion
- Event listeners

##### Key Interactions to Highlight

a) User Workflow:
- Writing markdown in D&D Beyond
- Configuring extension settings
- Viewing converted HTML

b) Technical Workflow:
- Content script injection
- DOM monitoring
- Markdown processing
- HTML rendering

##### Additional Elements

Supplementary components:
- Version information
- Supported markdown syntax reference
- Configuration options

##### Notes for Implementation Details

Annotations for:
- Markdown syntax support
- Tag-based processing options
- DOM manipulation points
- Storage mechanisms for settings

- Nested containers
- Text annotations
- Export to high-resolution formats

Remember to maintain a balance between technical detail and clarity, focusing on the extension's core functionality of converting markdown to HTML within the D&D Beyond environment while showing the configuration options available through the popup interface.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph ChromeBrowser
        subgraph ExtensionComponents
            Config["Extension Configuration"]:::config
            PopupUI["Popup Interface"]:::ui
            PopupControl["Popup Controller"]:::control
            ContentScript["Content Script & Markdown Engine"]:::script
            Assets["Visual Assets"]:::assets
        end

        subgraph DNDBeyond["D&D Beyond Website"]
            CharNotes["Character Notes"]
            DOM["DOM Elements"]
        end
    end

    User -->|"Writes Markdown"| CharNotes
    User -->|"Configures"| PopupUI

    PopupUI -->|"Settings"| PopupControl
    PopupControl -->|"Store Settings"| Config
    Config -->|"Load Settings"| ContentScript
    ContentScript -->|"Monitor & Process"| DOM
    ContentScript -->|"Convert Markdown"| CharNotes
    Assets -->|"Provide Icons"| PopupUI

    %% Click Events
    click Config "https://github.com/derhermann/beyondmarkdown/blob/main/manifest.json"
    click PopupUI "https://github.com/derhermann/beyondmarkdown/blob/main/src/popup.html"
    click PopupControl "https://github.com/derhermann/beyondmarkdown/blob/main/src/popup.js"
    click ContentScript "https://github.com/derhermann/beyondmarkdown/blob/main/src/contentScript.js"
    click Assets "https://github.com/derhermann/beyondmarkdown/tree/main/icons/"

    %% Styling
    classDef config fill:#f9f,stroke:#333
    classDef ui fill:#bbf,stroke:#333
    classDef control fill:#bfb,stroke:#333
    classDef script fill:#fbf,stroke:#333
    classDef assets fill:#fbb,stroke:#333

    %% Legend
    subgraph Legend
        L1["Configuration"]:::config
        L2["User Interface"]:::ui
        L3["Controllers"]:::control
        L4["Processing Engine"]:::script
        L5["Assets"]:::assets
    end
```
