Skip to content

About

Vibe-coding app to present slides from a json file

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

53 Commits

Folders and files

Repository files navigation

SelfHosted Slide Presenter

SelfHosted Slide Presenter is a lightweight, file-based presentation tool that runs in your web browser. It generates a slideshow from a structured JSON file, allowing you to focus on your content using predefined templates.

Features

  • Web-Based: Runs a local Python web server. View your presentation in any modern web browser.
  • JSON-Based: Slides are defined in a single JSON file (defaulting to slides.json).
  • Custom Theming: Define fonts, colors, and a persistent footer using a theme JSON file (defaulting to theme.json). The footer is displayed globally and uses the presentation title as a fallback if not explicitly set.
  • Slide Templates: Supports 8 layout templates including section titles, quotes, columns, images, and syntax-highlighted code blocks.
  • Speaker Notes: Press 'S' to open a synchronized speaker panel with a presentation timer, font size controls, and a resizable current/next slide preview area.
  • Easy Navigation: Control your presentation with keyboard shortcuts or your mouse.
  • PDF Export / Printing: Press 'P' in the browser to print or save as a 16:9 widescreen PDF, or run headlessly from the command line using --export-pdf.
  • Dynamic Reload: Update your slide or theme file and press 'R' to reload both the main presentation and speaker notes windows simultaneously.

Setup and Installation

  1. Prerequisites: Ensure you have Python 3.11+ installed.

  2. Virtual environment: Configure the virtual environment

    python3 -m venv venv
    source venv/bin/activate
  3. Dependencies: The application uses the Flask web framework (and Playwright for headless PDF export). Install them using pip:

    pip install -r requirements.txt
    playwright install chromium
  4. Directory Structure: The application source code is in src/.

    • slides/: Contains your slides.json and theme.json.
    • src/static/: Contains script.js and style.css.
    • src/templates/: Contains index.html.

How to Use

1. Create Slides

Create a slides.json file. This file contains the metadata and an array of slides.

Example (slides.json):

{
  "presentation_metadata": {
    "title": "Urban Eden: The Future of City Farming",
    "version": "1.0"
  },
  "slides": [
    {
      "template": "section_title",
      "data": {
        "title": "The Concrete Jungle Turns Green",
        "sentence": "Because your fire escape deserves better."
      }
    },
    {
      "template": "content_simple",
      "data": {
        "title": "Why Urban Gardening Matters",
        "sentence": "Key benefits of bringing nature back into the city:",
        "bullets": [
          "Reduction of urban heat island effect",
          "Zero-mile food production",
          "Mental health and stress reduction"
        ]
      }
    }
  ]
}

Supported Templates

For a precise definition of the JSON schema for each slide type, please refer to the slide_template_definition.md file.

Note: All slide templates support an optional speaker_notes field (string) inside the data object, which can contain Markdown text for the speaker notes. All templates also support an optional image_uri field if they include an image.

  1. section_title: A large centered title.
    • Data fields: title, sentence (optional).
  2. quote_slide: A large centered quote.
    • Data fields: quote, attribution.
  3. content_simple: A title with an optional introductory sentence and a single list of bullets.
    • Data fields: title, sentence (optional), bullets (array of strings).
  4. content_double: A title with two columns of bullets, each supporting an optional sub-heading and introductory sentence.
    • Data fields: title, column_left (object with sub_heading, optional sentence, bullets), column_right (object with sub_heading, optional sentence, bullets).
  5. content_and_image: A title with an optional introductory sentence and bullets on one side, and an image on the other.
    • Data fields: title, sentence (optional), bullets, image_position (left or right), image_uri (URL or path to a local image).
  6. title_and_image: A title with a centered image below it.
    • Data fields: title, image_uri.
  7. image_full_screen: An image that fills the entire slide without any text or footer.
    • Data fields: image_uri.
  8. title_and_code: A title with an optional introductory sentence and a syntax-highlighted code block.
    • Data fields: title, sentence (optional), code (string or array of line strings), language (optional, e.g. "python", "javascript").

2. Customize Your Theme

Create a theme.json file to customize the look and feel of your presentation.

{
  "font-main": "'Helvetica', sans-serif",
  "bg-color": "#FFFFFF",
  "text-color": "#000000",
  "link-color": "#0066CC",
  "footer-text": "My Presentation",
  "footer-font-size": "14px",
  "footer-text-color": "#888888"
}

3. Run the Application

Execute the Python script from your project's root directory:

python src/app.py

By default, the app looks for slides.json and theme.json under the slides/ directory.

Command-line Arguments

  • --slides: Specify a custom slides JSON file. If only a filename is provided, it is looked for in the directory specified by --slides-dir.
    python src/app.py --slides=my_presentation.json
  • --theme: Specify a custom theme JSON file. If only a filename is provided, it is looked for in the directory specified by --slides-dir.
    python src/app.py --theme=my_theme.json
  • --slides-dir: Specify a directory to look for default slides.json and theme.json files (default: slides). This directory is also used to resolve simple filenames provided via --slides or --theme.
    python src/app.py --slides-dir=my_content_folder
  • --export-pdf: Export the presentation directly to a 16:9 (1920x1080) widescreen PDF file using headless Chromium and exit without keeping the server running.
    python src/app.py --slides-dir=my_content_folder --export-pdf=my_presentation.pdf

Open your web browser and navigate to http://127.0.0.1:5000 to see your presentation.

Controls

Action Key Mouse
Next Slide Right Arrow / Down Arrow / Left-Click
Page Down / D / Space
Previous Slide Left Arrow / Up Arrow /
Page Up / A
Jump to Slide G Right-Click
Speaker Notes S
Reload Slides R
PDF Export / Print P
Show/Hide Help H (Toggle) / Esc (Hide)

All errors during execution will be logged to the terminal where app.py is running and to the browser's JavaScript console.


Open Source Libraries

This project utilizes the following open-source libraries:

  • Flask: A micro web framework for Python.
    • Authors: Armin Ronacher (creator) and the Flask Community.
    • License: BSD License.
  • Playwright: A framework for Web Testing and Automation, used for headless Chromium PDF export.
    • Authors: Microsoft and contributors.
    • License: Apache-2.0 License.
  • Marked.js: A markdown parser and compiler written in JavaScript.
    • Author: Troy Goode and contributors.
    • License: MIT License.
  • Highlight.js: A syntax highlighter written in JavaScript.
    • Author: Ivan Sagalaev and contributors.
    • License: BSD 3-Clause License.

We extend our sincere gratitude to the developers and communities behind these fantastic projects for their invaluable contributions to the open-source ecosystem.

About

Vibe-coding app to present slides from a json file

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages