How fbxyz/respysive-slide works
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