# waldyrious/rst-playground architecture

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

- Interactive diagram: https://gitdiagram.com/waldyrious/rst-playground
- Repository: https://github.com/waldyrious/rst-playground

## Overview

##### Main Components

a. Client-Side Components (Browser):
- HTML Interface (index.xhtml)
- JavaScript Runtime (script.js)
- CSS Styling (style.css)
- Pyodide Runtime Environment
- Docutils Python Package
- Pygments Python Package

##### Component Relationships

- User Interface Layer:
- Left side: Input textarea
- Right side: Output iframe
- Processing Layer:
- Pyodide Runtime (running in browser)
- Docutils Package
- Pygments Package for syntax highlighting
- RST Input → JavaScript → Pyodide → Docutils → HTML Output

##### Specific Implementation Details

- Blue rectangles for UI components
- Green rectangles for JavaScript components
- Yellow rectangles for Python/Pyodide components
- Purple rectangles for external dependencies

**┌─────────────────────────────── Browser Environment ───────────────────────────────┐**

- ┌─────────────┐            ┌─────────────────────────────────┐                  │
- Input     │            │        Pyodide Runtime          │                  │
- Textarea   │──────────▶│  ┌───────────┐   ┌───────────┐  │                  │
- ┘            │  │ Docutils  │   │ Pygments  │  │    ┌──────────┐ │
- ┘   └───────────┘  │───▶│  Output  │ │
- ┌─────────────┐            └─────────────────────────────────┘    │  iframe  │ │
- JavaScript  │                                                    └──────────┘ │
- Handler    │                                                                 │
- ┘                                                                 │

- ┘

##### Important Notes

- That this is a fully client-side application with no server component
- How Pyodide enables running Python code in the browser
- Real-time nature of the conversion (as user types)
- Main technologies: HTML5, JavaScript, CSS, Pyodide, Docutils, Pygments

##### Key Interactions to Highlight

- User input capture
- JavaScript to Pyodide bridge
- RST to HTML conversion process
- Real-time rendering in iframe

Remember to emphasize that this is a single-page application with no backend requirements, which makes it particularly portable and easy to deploy via GitHub Pages or any static hosting service.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser["Browser Environment"]
        subgraph UI["User Interface Layer"]
            Input["Input Textarea"]:::ui
            Output["Output iframe"]:::ui
            CSS["CSS Styling"]:::ui
        end

        subgraph Processing["Processing Layer"]
            JS["JavaScript Handler"]:::js
            
            subgraph PyodideRuntime["Pyodide Runtime Environment"]
                Docutils["Docutils Package"]:::python
                Pygments["Pygments Package"]:::python
            end
        end

        Input --> JS
        JS --> PyodideRuntime
        PyodideRuntime --> Output
        CSS --> UI
    end

    %% Click events for component mapping
    click Input "https://github.com/waldyrious/rst-playground/blob/main/index.xhtml"
    click JS "https://github.com/waldyrious/rst-playground/blob/main/script.js"
    click CSS "https://github.com/waldyrious/rst-playground/blob/main/style.css"

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef js fill:#2ecc71,stroke:#27ae60,color:white
    classDef python fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        UI_L["UI Component"]:::ui
        JS_L["JavaScript Component"]:::js
        PY_L["Python/Pyodide Component"]:::python
    end
```
