DEV Community

loading...
Cover image for point: simple HTML presentations

point: simple HTML presentations

skuzzymiglet
Go and Python as a hobby
・2 min read

This is a project that I've been working on for about a month.

What does it do?

It is a simple command-line program to convert markdown into a dynamic HTML presentation that can be opened anywhere. It embeds images so there are no file dependencies, and no special software is required to open the output, just a browser

Why?

  • GUI tools (PowerPoint, LibreOffice) have a heavy installation footprint and produce binary files
  • LaTeX beamer is hard to write
  • pandoc beamer is slow and has a huge installation size
  • Styling point output is as simple as writing some CSS
  • Familiar input, universal output

Themes

point currently includes 2 themes: the default and beamer-like, which tries to look like the LaTeX beamer "default" theme. There is also an -s flag to pass your own style.

If you can write CSS, which you probably can, please submit a PR at https://github.com/skuzzymiglet/point

Usage

  1. Make sure your system has a working Go installation
  2. go get github.com/skuzzymiglet/point
  3. Run point -h to test that it works
  4. Write a markdown file - a title (#) means a new slide or go to the examples directory where it's installed
  5. Run point -i [FILE] -o [OUTPUT]. If you don't specify -o, it will print to stdout.
  6. Optionally, pass -s for your own CSS style or a builtin one
  7. View the file in your browser

How it works

This is what happens in the 168 lines of Go:

  1. It renders the Markdown with https://gitlab.com/golang-commonmark/markdown
  2. It embeds images as base64
  3. It splits the markdown, creating a new slide each <h1>
  4. It inserts the chosen style, the script and the slides into a HTML template

The JS it inserts just waits for Left and Right, increments/decrements the slide index and switches it disply: block and all else to display: none.

Benchmarks

If you want to see for yourself how point performs agains pandoc beamer, clone https://github.com/skuzzymiglet/point and run benchmark.sh (make sure Go, pandoc, latex and hyperfine are installed).

pandoc beamer:
Benchmark #1: pandoc -i example.md -o out.pdf
  Time (mean ± σ):     450.2 ms ±   8.2 ms    [User: 388.9 ms, System: 67.2 ms]
  Range (min … max):   440.2 ms … 464.7 ms    10 runs

point:
Benchmark #1: ../point -i example.md -o out.html
  Time (mean ± σ):       7.7 ms ±   0.7 ms    [User: 5.6 ms, System: 2.6 ms]
  Range (min … max):     7.2 ms …  12.4 ms    205 runs

As you can see, point is almost 60x faster than pandoc

Targets

  • Much more styles - preferably imitating existing PowerPoint/Beamer styles
  • Tests
  • Automatic moving through slides
  • Showing the slide number
  • Tests
  • Webapp or GUI (easier interface than command line)

If you can help out with any of these, https://github.com/skuzzymiglet/point is the place.

Discussion (0)