Skip to main content

A tool to programmatically build slides using Reveal.js

Project description

Presento

A tool to programmatically build slides.

Using the excellent reveal.js library, this script helps you generate slides from Python.

You can easily create markdown slides or insert charts as HTML with Plotly.

Install

pip install presento

or use PDM, Poetry, etc...

Example

import plotly.express as px
from markdown import markdown

import presento

p = presento.Presentation(theme='serif')
p.add_md_slide(
    """
# title of the slide

This is a slide added directly to the presentation.

It uses markdown so it can have:
1. __formatting__
2. [links](https://en.wikipedia.org/wiki/Markdown)
3. lists

"""
)
# for the next slide we use plotly, but we need a CDN
p.add_cdn_js("https://cdn.plot.ly/plotly-latest.min.js")
fig = px.scatter(x=range(10), y=range(10))
p.add_html_slide(fig.to_html(include_plotlyjs=False, full_html=False))
p.add_columns_slide(
    [
        markdown("This is a column on the left"),
        fig.to_html(include_plotlyjs=False, full_html=False),
        # markdown("This is another column, on the right"),
    ]
)
# p.save_folder('my_slides')
p.show(port=8090)

In this example you can see that in addition to markdown slides you can add verbatim HTML, useful for example to add Plotly charts.

For Plotly (and pretty much every other library) you will want to use a CDN to load the JS once and reuse it across slides. This can be done with add_cdn_js.

The function add_columns_slide is an helper to generate a grid layout with the provided.

The show() method will start a server and open the browser for you.

The save_folder(path) method writes the slides to a folder, that can be statically served.

Theming

When creating the Presentation object, you can pass a theme parameter corresponding to the name of one of the Reveal themes. To create your own theme you need to follow the instructions on the Reveal.js website and replace it on the generated

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

presento-0.2.0.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

presento-0.2.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file presento-0.2.0.tar.gz.

File metadata

  • Download URL: presento-0.2.0.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.8 CPython/3.11.2

File hashes

Hashes for presento-0.2.0.tar.gz
Algorithm Hash digest
SHA256 83ab7d734ff2205547a4745b37cefa801af1ae2f55963775282504577222cf83
MD5 0889734263de7ca7202acf4ac4577cc5
BLAKE2b-256 39a7afb383cd5bdee6823d448f5eddda2bdc32055c57a296d897dd175bb0dce0

See more details on using hashes here.

File details

Details for the file presento-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: presento-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.8 CPython/3.11.2

File hashes

Hashes for presento-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02b6cbaf26e8fd31ac8d3fbe959cbeb50376d600c7216acb38fec65cb30ec085
MD5 ba1078e6c554d628b6235df75e33cdd1
BLAKE2b-256 6e905648bbdf095ce3995a6751240370e6391323e1cc6a073081b82b3887daca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page