Package: webslides
WebslidesWebslides is a Python package that allows you to create PowerPoint-like slides in HTML format. It provides several advantages over traditional PowerPoint presentations, such as clickable content, interactivity with plotly figures and other elements, and the ability to create and update a presentation using Python.Live demoHere is alive demoof an output of Webslides, demonstrating most of its features.AdvantagesSome key advantages of using HTML over PowerPoint include:Pages can be as long (or short) as needed, which is handy for taller diagramsAllows for clickable content, like internal links for page navigation and external links to sourcesTooltips can be usedAllows interactivity with plotly figuresAllows interactivity with other elements, such as folium geographical mapsCan be shared by attachment in emailVery compact file size (no images)Easy to update by rerun of Python codePotential drawbacksLet's be honest, potential drawbacks may be:Python is required to create presentationsRecipients cannot easily alter the presentationNo WYSIWYG editing in a graphical user interfaceNo easy conversion to PDF / printableNo custom styling (ie. company style)Main FeaturesHere are some of the things that Webslides does well:Generate an index page based on your contentGenerate a highlights page, based on your contentIncludes page navigation to easily navigate through the documentConverts plotly figures to HTMLDependenciesWebslides has two dependencies:Pandas: a Python package that provides fast, flexible, and expressive data structures for data analysisPlotly: an interactive data visualization library that allows you to create a wide range of charts, graphs, and other visualizationsWebslides uses Pandas to process the content that is included in your presentation.
The Plotly package is used to convert Plotly figure objects to HTML.InstallationTo install Webslides, simply run the following command:pip install webslidesExamplesHere are some examples to get you started:## Create demo presentation and save to file demo.html

# imports
import webslides as ws

ws.demo()## create most basic presentation with one slide, no title page, no index page

# imports
import webslides as ws

# title_page
title_page = {
    'img_url': '',
    'title': 'One Page Presentation',
    'summary': {'Context': 'Just some example to get started', 'Author': 'Me!'},
}
    
# content
content = {
    'Topcat A': {
        'Subcat X': {
            'page1': {
                'title': 'Page title 1!',
                'highlights': ['- highlight 1', '- highlight 2'],
                'body': 'Content 1: this is a <b>HTML string</b>',
                'footer': ['- footer 3', '- <i>italic footer 4</i>']
            }
        }
     }
 }

# create presentation
ws.create(content=content
          , title_page=title_page
          , fname='webslides_basic_example.html'
          , open_in_browser=True
          , show_index_page=False
          , show_topcat=False
          , show_subcat=False
          , show_highlights_page=False
          , show_highlights_only=False)createFunction DocumentationThecreatefunction is used to generate an HTML file with a custom structure based on the provided input parameters. It has the following parameters:Parameterstitle_page(dict,optional, default=None): A dictionary containing the title page information. It should include an image URL (optional), a title, a summary, and a footer.Example input:title_page = {
        'img_url': '',
        'title': 'Title of Title Page',
        'summary': {'Summary item 1': 'item text 1', 'Summary item 2': 'item text 2'},
        'footer': ['- use custom title image via the img_url parameter', '- footer2']
    }content(dict,optional, default=None): A dictionary containing the content pages organized by top categories and subcategories.Example input:content = {
    'Topcat A': {
        'Subcat X': {
            'page1': {
                'title': 'Page Title 1 - HTML body',
                'highlights': ['- highlight 1', '- highlight 2'],
                'body': 'Content 1: this is a <b>HTML string</b>',
                'footer': ['- footer 1a', '- <i>italic footer 1b</i>'],
                'show': True},
                ...
            },
        ...
        },
    ...
}fname(str,optional, default='output.html'): The output filename for the generated HTML file.open_in_browser(bool,optional, default=True): If set to True, the generated HTML file will be opened in the default web browser.show_index_page(bool,optional, default=False): If set to True, an index page will be displayed with links to all content pages.show_highlights_page(bool,optional, default=False): If set to True, a highlights page will be displayed with a summary of the highlights from each content page.show_topcat(bool,optional, default=True): If set to True, the top category will be displayed in the index and highlights pages.show_subcat(bool,optional, default=True): If set to True, the subcategory will be displayed in the index and highlights pages.show_highlights_only(bool,optional, default=False): If set to True, only content pages with highlights will be shown in the index and highlights pages.tooltips(dict,optional, default=None): Dictionary with keys 'topcats' and 'subcats' and with topcat/subcat as keys, with each a dict wit keys and values with the respective topcat names and tooltip texts.Page Dictionary ParametersEach content page dictionary within the content parameter can include the following keys:title(str,mandatory): The title of the content page.body(str or object,mandatory): The body of the content page. It can be a string containing HTML or an object (e.g., a Plotly figure).highlights(list of str,optional): A list of highlights for the content page. If not provided, no highlights will be displayed, and the page will not have a lightbulb icon in the index page.footer(list of str,optional): A list of footer items for the content page. Each item can include HTML tags.show(bool,optional): If set to False, the content page will be hidden in the output. If not provided or set to True, the page will be shown.