1156 Commits

Author SHA1 Message Date
Ivan G.
8935e1d110
Update introduction.md
Fix broken link to installation guide  in introduction.md
2025-02-13 19:24:30 +00:00
Matias Fontanini
793073a373
feat: support images in footer (#450)
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:


![image](https://github.com/user-attachments/assets/f04dc955-8103-4c13-b617-307267a617ed)

Fixes #437
2025-02-13 05:52:29 -08:00
Matias Fontanini
bf6a15dce5 feat: support images in footer 2025-02-13 05:38:55 -08:00
Matias Fontanini
75116ba29c
feat: add support for wikilinks (#448)
This adds wikilinks support via the `[[url]]` syntax.

Relates to #447
2025-02-12 05:12:48 -08:00
Matias Fontanini
17476f2c0c feat: add support for wikilinks 2025-02-12 04:58:03 -08:00
Matias Fontanini
f58cc80820
fix: don't squash image if font is not 2:1 (#446)
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
2025-02-11 16:16:33 -08:00
Matias Fontanini
828ef016ec fix: don't squash image if font is not 2:1 2025-02-11 16:09:31 -08:00
Matias Fontanini
fc01bc57df
chore: restructure Terminal code and add test for margins/layouts (#443)
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.
2025-02-09 14:33:57 -08:00
Matias Fontanini
af8c7d6f0d chore: add tests for margins/columns handling in engine 2025-02-09 14:29:12 -08:00
Matias Fontanini
6771c2f8a2 chore: create trait out of Terminal 2025-02-09 13:16:38 -08:00
Matias Fontanini
fc5062eb7a
feat!: sanitize theme footer's templates (#442)
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.
2025-02-07 06:23:31 -08:00
Matias Fontanini
80c6df34aa feat!: sanitize theme footer 2025-02-07 06:11:24 -08:00
Matias Fontanini
56923ab97a
chore: use fastrand instead of rand (#441)
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.
2025-02-06 06:50:30 -08:00
Matias Fontanini
d2c0379465 chore: remove rayon feature in image 2025-02-06 06:32:02 -08:00
Matias Fontanini
99b5212af9 chore: don't pull in getrandom via tempfile 2025-02-06 06:30:55 -08:00
Matias Fontanini
dbd4f9c1ea chore: use fastrand instead of rand 2025-02-06 06:22:31 -08:00
Matias Fontanini
1e3b3ff26d
perf: avoid cloning strings when styling them (#440) 2025-02-06 06:16:32 -08:00
Matias Fontanini
7abfb5a7bc perf: avoid cloning strings when styling them 2025-02-06 06:13:03 -08:00
Matias Fontanini
fb0223bb83
feat: add support for kitty's font size protocol (#438)
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
2025-02-05 16:20:13 -08:00
Matias Fontanini
8093875aea docs: move notes around external code highlighting via bat 2025-02-05 15:58:05 -08:00
Matias Fontanini
2935eb617f docs: add redirects from old routes 2025-02-05 15:56:18 -08:00
Matias Fontanini
1235a26f75 feat: add support for kitty's font size spec 2025-02-05 06:29:00 -08:00
Matias Fontanini
33c7c9705c docs; fix latex image link 2025-02-02 16:57:32 -08:00
Matias Fontanini
dacb291de2 docs: link speaker notes example 2025-02-02 14:49:52 -08:00
Matias Fontanini
5a909259c8
docs: restructure docs mdbook (#436)
This splits the docs a bit so pages are not yuge.
2025-02-02 14:39:02 -08:00
Matias Fontanini
3379d7a9cb docs: restructure docs mdbook 2025-02-02 14:33:39 -08:00
Matias Fontanini
f8e9ec6728 docs: fix code to image conversion example 2025-02-02 13:11:34 -08:00
Matias Fontanini
64b52334d7 chore: fix changelog formatting v0.10.0 2025-02-02 13:02:21 -08:00
Matias Fontanini
5eb2391d62
chore: 0.10.0 changes (#435) 2025-02-02 13:00:07 -08:00
Matias Fontanini
c51ce7dbf9 chore: bump version to 0.10.0 2025-02-02 12:56:58 -08:00
Matias Fontanini
7bbd1ff9db chore: update sample config files to include newest options 2025-02-02 12:56:58 -08:00
Matias Fontanini
a02b8c4d86 chore: link speaker notes guide in README 2025-02-02 12:56:58 -08:00
Matias Fontanini
3911f15cbc chore: update demo presentation to use new features 2025-02-02 08:41:33 -08:00
Matias Fontanini
fd45d96e1c docs: add docs on 0.10.0 features 2025-02-02 08:41:33 -08:00
Matias Fontanini
09e9f003ed chore: add 0.10.0 changes to changelog 2025-02-02 08:39:19 -08:00
Matias Fontanini
55dcee47c1
chore: rename alerts symbol to icon (#434) 2025-02-02 06:11:16 -08:00
Matias Fontanini
4a294b9fe7 chore: rename alerts symbol to icon 2025-02-02 06:08:40 -08:00
Matias Fontanini
68b10c1807
fix: alert styling for built in themes (#433) 2025-02-01 15:16:05 -08:00
Matias Fontanini
622453b96c fix: use some default colors for alerts if not set 2025-02-01 15:13:18 -08:00
Matias Fontanini
272ba07abe fix: alert styling for built in themes 2025-02-01 14:56:26 -08:00
Matias Fontanini
96b020ce6d
fix: re-set original colors after printing colored text (#432) 2025-02-01 14:47:35 -08:00
Matias Fontanini
6f305ef5b1 fix: re-set original colors after printing colored text 2025-02-01 14:41:07 -08:00
Matias Fontanini
55639a4523
docs: enable mdbook-alerts preprocessor (#431)
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.
2025-02-01 14:00:03 -08:00
Matias Fontanini
808a1209ff docs: enable mdbook-alerts preprocessor 2025-02-01 13:56:54 -08:00
Matias Fontanini
f6daf38c46
feat: add symbols to alerts (#430)
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:


![image](https://github.com/user-attachments/assets/ce90a4e0-7543-4100-83b2-5f8d86f4cbe2)
2025-02-01 06:11:22 -08:00
Matias Fontanini
7643b8f988 ci: use stable toolchain to run clippy 2025-02-01 06:08:06 -08:00
Matias Fontanini
3a389c1c7e feat: add symbols to alerts 2025-01-31 06:43:24 -08:00
Matias Fontanini
22af0665c0
feat: add +image to code blocks to consume their output as an image (#429)
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 

![image](https://github.com/user-attachments/assets/e7bd7a97-5dd4-457b-ac24-1a6592ae6d24)

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.
2025-01-28 17:07:10 -08:00
Matias Fontanini
5968289562 feat: add +image to code blocks to consume their output as an image 2025-01-28 16:53:28 -08:00
Matias Fontanini
e4b2b388b7
fixup: support colors in block quotes (#428)
This is a followup on #427 which didn't consider styled text inside a
block quote.
2025-01-27 05:39:08 -08:00