This allows using images in a footer template. For now they can only be
used in the left and center templates by using this syntax:
```yaml
footer:
style: template
left:
image: path-to-image
# the height of the footer. defaults to 3
height: 3
```
Images will preserve aspect ratios and will expand to take up as much of
the `height` attribute as possible. Therefore, to scale images, simply
bump that number up/down.
Images are looked up:
* Relative to the presentation's file, just like any other image.
* Inside the themes directory (~/.config/presenterm/themes).
Example using random logo:

Fixes#437
Images looked a little squashed vertically if the font being used in the
terminal didn't have a 2:1 ratio between between columns and rows. This
also adds some much needed tests around this code, and fixes some
rounding issues when the image is small enough to only need a handful of
columns/rows to be displayed.
Fixes#445
This refactors the `Terminal` code a bit to be able to test it, and add
tests to layout handling since the implementation for #437 will require
creating new rect to print the images in.
This sanitizes the theme footer's template so that we have sure that
it's not malformed and doesn't reference any variables that can't be
used (e.g. `{bar}`). This now also avoids allocation a bunch of strings
when rendering the footer, since every variable was being replaced via
`str::replace`.
This is a breaking change for anyone who already has a malformed string
in their string templates. If someone does use a string like `{lord}
George` in their footer please bring it up and we can see what to do.
This switches to from `rand` to `fastrand`. `rand` was also being pulled
in via `image/rayon` so I disabled it. There's no use case here that
demands parsing images at crazy fast speeds so whatever rayon is doing
is likely not needed; we can revisit if someone finds perf issues.
This adds support for kitty's font size protocol
(https://github.com/kovidgoyal/kitty/issues/8226) which allows printing
characters that take up more than one cell. This feature will be
available in kitty >= 0.40.0 and is currently only available in nightly
builds.
This for now is only supported in a subset of the theme components,
namely:
* The introduction slide's presentation title
(`intro_slide.title.font_size`).
* The slide titles (`slide_title.font_size`).
* The headings (`headings.h*.font_size`).
Font sizes are only used if the terminal emulator supports it so this
doesn't change anything for emulators other than kitty (or other
implementors of the protocol). If you find this somehow breaks
something, please create an issue.
For now all built in themes set `intro_slide.title.font_size=2` and
`slide_title.font_size=2`. I think this looks a lot better this way but
please do comment here if you don't think built in themes should come
with these values set.
These are now the first 2 slides in the `demo.md` example:
https://github.com/user-attachments/assets/8d761d86-8855-498a-9766-5294cdae3b57
This adds the mdbook-alerts preprocessor, and removes all the catppuccin
theme related files since they created issues when bumping mdbook and
I'd rather not have to deal with that.
This is a follow up on #423 that adds symbols before the title of alert
type elements. The structure of the theme changed a bit to be able to
pack the styles for each alert type into a single type.
This causes the following presentation:
```markdown
> [!note]
> this is a note
> [!tip]
> this is a tip
> [!important]
> this is important
> [!warning]
> this is warning!
> [!caution]
> this advises caution!
>>> [!note] other title
ez
multiline
>>>
```
To render like this:

This adds a new `+image` attribute to code blocks. This inherits
`+exec_replace` (meaning it has the same semantics and requires being
enabled with the same parameters) but it assumes the output of the
executed block is an image and renders it as such.
This means a presentation like the following one:
~~~markdown
hi
----
```bash +image
curl -s -L -o - 'https://github.com/mfontanini/presenterm/blob/master/examples/doge.png?raw=true'
```
~~~
Renders like this

For this to work, **the entire output of the code snippet must be an
image written to stdout**.
An application of this feature could be to have text to image
conversions to create titles on the fly. Hopefully this opens up the
door for more creative ideas users will definitely have.