Simple Slides with Markdown and Python
Tags: python, productivity
Published: 2020-10-29 07:30:55

# The Pain of PowerPoint

As a software developer, it's never fun to try and present my work using slides. Despite the bloat of tools like PowerPoint, when I'm trying to present code, they still somehow end up feeling restrictive. I find myself spending ages trying to center and format text all while shimming in screenshots of my code when I should really be focusing on the content of my presentation.

So over a few weekends I set out to create tool that would:

1. Split a Markdown document into slides on each new title
2. Convert the Markdown slides into HTML
3. Serve up the HTML using a simple web server
4. Be able to embed interactive widgets into slides

# Slidedown

To satisfy the above goals I created [Slidedown](https://github.com/rmorshea/slidedown), a simple, `pip` installable, Python-based command line tool that can turn Markdown documents like this:

```markdown
# Step 1

Create an awesome slide deck.

# Step 2

Present it to awesome people.

# Step 3

Profit?
```

Into slides like this:

![slides-gif](https://github.com/rmorshea/slidedown/raw/master/docs/simple-slide-example.gif)

With one simple CLI command:

```bash
slidedown README.md
```

# Embedding Interactive Widgets

Slidedown was built on top of another one of my projects called [IDOM](https://idom-docs.herokuapp.com/docs/index.html) - a package that blurs the lines between Javascript and Python. IDOM allows you to create highly interactive web pages without writing a single line of Javascript.

In Slidedown I've used it to enable you to embed interactive widgets into your slides in pure Python. With the following markup:

```markdown
# Hello IDOM!

<span data-idom="hello.py" />
```

and a script `hello.py` containing:

```python
import idom

@idom.element
def Main():
    hi_count, set_hi_count = idom.hooks.use_state(1)
    return idom.html.button(
        {"onClick": lambda event: set_hi_count(hi_count + 1)},
        f"IDOM said hi {hi_count} time(s)",
    )
```

you'll display a slide with an interactive button:

![embedding-idom-gif](https://github.com/rmorshea/slidedown/raw/master/docs/slidedown-hello-idom.gif)

The possibilities with IDOM are limitless. You can embed everything from data dashboards to games. To see even more, check out some [examples](https://idom-docs.herokuapp.com/docs/examples.html) and be sure to try out the live examples!

# Sharing Slides?

The beauty of using Markdown is that to share it, you can just create a repo on GitHub, GitLab, or BitBucket and upload your slides as a `README.md` that you can link to. All the resources for your slides (e.g. images) are also as easily accessible in the very same repository.

Of course if you have any embedded widgets then those won't be displayed on you're repo's page. On the other hand though, if you were using PowerPoint you wouldn't have those anyway, so it's not such a huge loss. However if you colleagues know how to clone your repository and `pip` install `slidedown` then all it takes is one simple command to run your slides locally for themselves.

# Conclusion

- If you ✍️ Slides
- you 😠 PowerPoint
- and you ❤️ Markdown

Then you should give [Slidedown](https://github.com/rmorshea/slidedown) a try.