# fbxyz/respysive-slide architecture

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

- Interactive diagram: https://gitdiagram.com/fbxyz/respysive-slide
- Repository: https://github.com/fbxyz/respysive-slide

## Overview

##### Project Type and Purpose
- This is a Python “open-source tool” (library) named respysive-slide, not a web service or full-stack app.
- Its purpose is to let users write Python code (using `Slide` and `Presentation` classes) to generate interactive HTML presentations powered by Bootstrap and Reveal.js, with support for Matplotlib/Altair/Plotly charts and LaTeX.

##### File-Structure Analysis
– Top-level:
- LICENSE, README.md – metadata & docs
- pyproject.toml, requirements.txt – packaging & dependencies
- readme_example.py/html – sample client code & output
- assets/ – CSS (custom themes) and static images
– Package: `respysive/`
- container.py – HTML container abstractions (rows, columns)
- content.py – content‐type model (text, image, chart, cards)
- presentation.py – orchestrator: collects slides, applies global settings, renders HTML
- utils.py – helpers: detect content type, JSON conversion for charts, CSS/class injection
- version.py – package version metadata

##### README Insights
- Two main public APIs:
– `Slide` class: build a slide by adding title pages, titles, content blocks, cards
– `Presentation` class: aggregate slides (horizontal & vertical), apply theme/size parameters, export to HTML
- Underlying work:
– Converts Python objects (markdown strings, Matplotlib figures, Plotly/Altair JSON) into HTML fragments
– Bundles CSS (Bootstrap, custom ABM CSS) and JS (Reveal.js, FontAwesome) via CDN links
– Uses Jinja2 (or simple templating) to glue fragments into a final HTML page

##### Main Components & Interactions (
A. Client Layer (Python script)
- Imports `respysive.Slide` & `respysive.Presentation`
- Calls slide-building methods (`add_title`, `add_content`, `add_card`)
- Calls `Presentation.add_slide()` and `Presentation.save_html()`
B. Library Core (respysive package)
1. Presentation module
– Manages slide collection, global settings (theme, size, margins)
– Triggers HTML rendering
2. Slide module (in content.py + container.py)
– Holds content items, per-slide kwargs (background, centering)
– Uses container abstractions to wrap content in Bootstrap rows/cols
3. Utils module
– Detects content types, converts charts to JSON or SVG
– Applies CSS styles & class attributes
C. Template/Asset Layer
- A Jinja2 or built-in HTML template (not explicitly in tree, but implied)
- Static assets from `assets/css` & `assets/img`
- External CDN references:
– Bootstrap CSS/JS, Reveal.js core & plugins, FontAwesome
D. Output & Runtime
- Generated HTML file
- Browser loads HTML → executes Reveal.js carousel, Bootstrap layout, renders charts (Plotly, Altair interactivity)

##### Architectural Patterns & Principles
– Builder/Fluent API: user code chains calls on Slide and Presentation
– Factory/Strategy for content detection (utils picks correct renderer for text vs chart vs image)
– Separation of Concerns:
- Presentation orchestrates flow and settings
- Slide/content modules focus on per-slide data modeling
- Utils handle low-level helper functions
- Assets & template layer handle final presentation rendering

##### Putting It All Together
– Show Slide → Content/Container → Utils → Template
– Show Presentation coordinating multiple Slide instances and invoking the Template engine

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    Client["Client Python Script"]:::external
    click Client "https://github.com/fbxyz/respysive-slide/blob/master/readme_example.py"

    %% Library Core
    subgraph "Library Core"
        Presentation["respysive.Presentation"]:::internal
        SlideContent["respysive.Slide & Content Model"]:::internal
        Container["respysive.Container Abstractions"]:::internal
        Utils["respysive.Utils Module"]:::internal
        Version["Version Metadata"]:::internal
    end
    click Presentation "https://github.com/fbxyz/respysive-slide/blob/master/respysive/presentation.py"
    click SlideContent "https://github.com/fbxyz/respysive-slide/blob/master/respysive/content.py"
    click Container "https://github.com/fbxyz/respysive-slide/blob/master/respysive/container.py"
    click Utils "https://github.com/fbxyz/respysive-slide/blob/master/respysive/utils.py"
    click Version "https://github.com/fbxyz/respysive-slide/blob/master/respysive/version.py"

    %% Configuration & Docs
    PackageConfig["Package Config & Dependencies"]:::doc
    click PackageConfig "https://github.com/fbxyz/respysive-slide/blob/master/pyproject.toml"
    click PackageConfig "https://github.com/fbxyz/respysive-slide/blob/master/requirements.txt"
    Docs["Documentation & Metadata"]:::doc
    click Docs "https://github.com/fbxyz/respysive-slide/blob/master/README.md"
    click Docs "https://github.com/fbxyz/respysive-slide/tree/master/LICENSE"

    %% Template & Assets
    subgraph "Template & Asset Layer"
        TemplateEngine["Template Engine (Jinja2)"]:::internal
        CSSAsset["Custom CSS Themes"]:::asset
        ImgAsset["Static Images"]:::asset
        ExternalCDN["External CDN (Bootstrap, Reveal.js, FontAwesome)"]:::external
    end
    click CSSAsset "https://github.com/fbxyz/respysive-slide/tree/master/assets/css/"
    click ImgAsset "https://github.com/fbxyz/respysive-slide/tree/master/assets/img/"

    %% Output & Runtime
    GeneratedHTML["Generated HTML File"]:::asset
    click GeneratedHTML "https://github.com/fbxyz/respysive-slide/blob/master/readme_example.html"
    Browser["Browser Runtime"]:::runtime

    %% Connections
    Client -->|"import Slide, Presentation"| SlideContent
    Client -->|"call add_slide(), save_html()"| Presentation
    Presentation -->|"manages slides"| SlideContent
    SlideContent -->|"wraps content"| Container
    SlideContent -->|"detects content type"| Utils
    Utils -->|"injects CSS/classes"| TemplateEngine
    Presentation -->|"triggers rendering"| TemplateEngine
    Version -->|"provides version info"| Presentation
    PackageConfig -->|"defines deps"| Utils
    Docs -->|"guides usage"| Client
    TemplateEngine -->|"uses assets"| CSSAsset
    TemplateEngine -->|"uses assets"| ImgAsset
    TemplateEngine -->|"embeds CDN links"| ExternalCDN
    TemplateEngine -->|"outputs HTML"| GeneratedHTML
    GeneratedHTML -->|"loaded in"| Browser
    Browser -->|"loads JS/CSS"| ExternalCDN

    %% Styles
    classDef internal fill:#a2d2ff,stroke:#023e8a,color:#03045e
    classDef external fill:#ffcad4,stroke:#9b2226,color:#660708
    classDef asset fill:#caffbf,stroke:#2f5233,color:#1b4332
    classDef runtime fill:#ffd6a5,stroke:#e65100,color:#7f2704
    classDef doc fill:#e0c3fc,stroke:#5f0f40,color:#3a0ca3
```
