1136 Commits

Author SHA1 Message Date
bd1f097e1b
feat: added quick dirty workaround to customize export font
Added a quick dirty workaround that uses environment variable
`PRESENTERM_EXPORT_FONT` to set the a custom font when exporting to pdf
2025-04-26 22:39:08 -06:00
Matias Fontanini
cae76380fa chore: fix changelog attribution 2025-04-25 06:55:52 -07:00
Matias Fontanini
78a3df199e chore: fix typo in changelog link 2025-04-25 06:16:31 -07:00
Matias Fontanini
4bf1f10d83
chore: prepare for 0.13.0 changes (#568) v0.13.0 2025-04-25 06:09:22 -07:00
Matias Fontanini
c561907259 chore: bump version to 0.13.0 2025-04-25 06:05:55 -07:00
Matias Fontanini
0836c82f68 chore: update README with 0.13.0 changes 2025-04-25 06:05:55 -07:00
Matias Fontanini
232fc34fce chore: update docs to include 0.13.0 changes 2025-04-25 06:05:55 -07:00
Matias Fontanini
a894105b9b chore: add changelog entries for 0.13.0 2025-04-25 05:56:31 -07:00
Matias Fontanini
54bddaf017
feat: allow specifying start/end lines in file snippet type (#565)
This adds new optional `start_line` and `end_line` properties when using
a `file` type snippet, which allow specifying the line range to be used.

Caveats:

* The line selection is applied before highlighting so if you truncate
the file in a place that should be highlighted in some way because of
something that came before (e.g. multi line comments) it won't be
highlighted appropriately. This can be fixed but requires changing a few
things and I think this should not be hit very often.
* Using `+line_numbers` will always start at 1. In the future I may add
a property like `preserve_line_numbers` but again this would require
changing a few things (the same ones as the point above) so I kept it
this way for now.

Example:

~~~markdown
```file +line_numbers
language: rust
path: scripts/foo.rs
start_line: 3
end_line: 20
```
~~~

Closes #562
2025-04-23 19:33:16 -07:00
Matias Fontanini
510af31320 feat: allow specifying start/end lines in file snippet type 2025-04-23 19:28:46 -07:00
Matias Fontanini
abc132e9b5
feat!: hide JSON schema generation behind feature flag (#563)
This hides the JSON schema generation for the config file behind a new
`json-schema` feature flag. This is not fundamental to the functioning
of this tool and also there's already a schema generated
[here](https://github.com/mfontanini/presenterm/blob/master/config-file-schema.json)
so there's no need to have this available in the tool when released. If
anyone does want the JSON schema for some specific version of the tool,
they can always clone the repo and `cargo run --features json-schema`.

This also removes the `serde_with` dependency and instead hand rolls the
`SerializeDisplay` and `DeserializeFromStr` macros manually. These are
very few lines long and doesn't make importing that crate worth it.

Overall these 2 changes cause the number of crates to go down by
something like 20 which is great.
2025-04-22 19:38:05 -07:00
Matias Fontanini
8eaee8355d chore: hand roll serde_with macros and remove it as dependency 2025-04-22 16:34:56 -07:00
Matias Fontanini
d89f25792c chore: gate json schema generation behind feature flag 2025-04-22 16:02:28 -07:00
Matias Fontanini
d2f6617ec6
feat: add julia language highlighting and execution support (#561)
This adds support for highlighting and executing julia code snippets. 

Closes #559
2025-04-21 19:05:06 -07:00
Matias Fontanini
910c9cbe84 feat: add julia language highlighting and execution support 2025-04-21 19:01:44 -07:00
Matias Fontanini
94ce0a9225
feat: add collapse_horizontal slide transition (#560)
This adds a new `collapse_horizontal` slide transition that collapses
the current slide into the center of the screen.



https://github.com/user-attachments/assets/a398c286-ae3e-4c99-81aa-26aba498726d
2025-04-21 18:59:02 -07:00
Matias Fontanini
3d31c5f722 feat: add collapse_horizontal slide transition 2025-04-21 18:52:37 -07:00
Matias Fontanini
0c2f7ee945
feat: allow letting pauses become new slides when exporting (#557)
This introduces the config property `export.pauses` which when defaults
to `ignore` but when set to `new_slide` causes the PDF export to contain
a new slide every time a pause is found.

Closes #555
2025-04-20 14:38:58 -07:00
Matias Fontanini
e063f46a86 feat: allow letting pauses become new slides when exporting 2025-04-20 14:35:40 -07:00
Matias Fontanini
aa7cdae105
chore: refactor async renders (#556)
This refactors how async renders work. Before this change, the presenter
had to periodically poll them to pull their state into the operation,
and had to figure out which slides had async renders to be able to poll
them at the right times. This was tedious and error prone, especially
once slide transitions were introduced: we now had to preemptively poll
the next/previous slide because there could be something being async
rendered (e.g. a mermaid diagram) and we didn't want to transition into
a slide with a "Loading..." text when the generated image was available,
just not polled yet.

This now moves all polling to a separate thread. When an operation needs
to be polled (be it because it automatically starts async rendering or
it requires to be triggered by pressing `<c-e>`), now a `Pollable` type
is created that is essentially a container for the logic to poll and a
state shared with the operation. This lets a `Poller` periodically poll
all `Pollables` that need polling (lols). The result is a lot less code
around `Presenter`/`Presentation` to deal with triggering and polling
async renders. Also the handling for async render errors is now much
nicer because it can be treated almost the same way as a successfully
finished async render.
2025-04-20 14:15:57 -07:00
Matias Fontanini
5ec3a12d30 chore: refactor async renders 2025-04-20 14:04:41 -07:00
Matias Fontanini
31f7c6c1e2
feat: allow using images on right in footer (#554)
This adds support for footer images on the right, just like allowed for
left/center. Now that there's tests for this and after being
restructured fairly recently it's much easier to get _right_.

The following presentation now renders like the following:

```markdown
---
theme:
    override:
        footer:
            height: 5
            style: template
            left:
                image: ../examples/doge.png
            center:
                image: ../examples/doge.png
            right:
                image: ../examples/doge.png
---

Footer images
===
```


![image](https://github.com/user-attachments/assets/2dfeb096-eba6-43a2-973c-b3d187c14086)

Closes #549
2025-04-17 16:04:45 -07:00
Matias Fontanini
93359444de feat: allow using images on right in footer 2025-04-17 15:58:00 -07:00
Matias Fontanini
f59c19af36
perf: pre scale generated images (#553)
Before this change only filesystem images were scaled when transitioning
between slides. This PR does that for generated images as well, and
polls other slides while doing transitions so any images generated
asynchronously are already ASCII'd before we transition into them.

This PR has shown that the async render code has reached proper 💩
level and requires changing it, more so since #537 will be implemented
soon-ish.
2025-04-17 15:38:58 -07:00
Matias Fontanini
7908b65a51 perf: pre-scale generated images in other slides as they pop up 2025-04-17 15:30:23 -07:00
Matias Fontanini
5eee8a9fae perf: cache generated images as ascii 2025-04-16 16:28:56 -07:00
Matias Fontanini
a97e66fedf
perf: pre-scale ascii images when transitions are enabled (#550)
This pre-scales images when the presentation is reloaded and transitions
are enabled. For now only filesystem images are scaled but the next PR
will do this for generated ones as well. The end result of this is when
you transition between slides and there's images in them, the animation
is smooth the first time because the scaling, which is costly, is done
ahead of time.
2025-04-14 17:57:15 -07:00
Matias Fontanini
eca6ce91bf perf: pre-scale ascii images when transitions are enabled 2025-04-14 17:53:13 -07:00
Matias Fontanini
9e1f2beca2
perf: cache resized ascii images (#547)
This caches:
* Ascii images so we don't reload them every time we're doing slide
transitions.
* Ascii image resizes, so if we go to a slide that contains an image and
we're using slide transitions, the next transition that includes that
image won't require resizing it to that same sizes.

The one performance "issue" still present when using slide transitions
is that we still need to pay for that first image -> ascii image
conversion and that first ascii image resize the first time we
transition to a slide that contains an image. This is currently
noticeable in debug mode and not in release mode (at least in my machine
™️), but it would be sweet if it wasn't there ever. For this we need to
run through all slides, find all images, ascii convert them and resize
them to the current terminal size. The same should be done when the
terminal is resized.
2025-04-13 14:29:53 -07:00
Matias Fontanini
73211528a4 perf: cache ascii image resizes 2025-04-13 14:21:04 -07:00
Matias Fontanini
a5e89eb5a3 perf: cache ascii images when doing slide transitions 2025-04-13 14:02:41 -07:00
Matias Fontanini
733786154b chore: move image cache to image printer 2025-04-13 13:38:09 -07:00
Matias Fontanini
4786c5a84c chore: unify image registering functions 2025-04-13 13:18:26 -07:00
Matias Fontanini
7f3d878410
docs: add links to presentations using presenterm (#544)
It turns out I'm a heavy user of _presenterm_!

I only added my presentations - let me know if you know of any others I
should add.

closes #538
2025-04-13 12:48:38 -07:00
Matias Fontanini
2b6864c215
fix: center overflow lines when using centered text (#546)
This fixes an issue where centered text that overflowed had the lines 2+
start at the same column as the first one rather than being centered.

Fixes #545
2025-04-13 12:45:22 -07:00
Matias Fontanini
02fcba89cc fix: center overflow lines when using centered text 2025-04-13 12:40:28 -07:00
Orhun Parmaksız
1eb7d9e995
docs: add links to presentations using presenterm 2025-04-12 12:37:42 +03:00
Matias Fontanini
913c5ed838
fix: don't add extra space before heading if prefix is empty (#542)
Headings were being added an extra space if they had an empty string
configured as the prefix. This worked correctly if the prefix was `null`
but not if it was "".

Fixes #541
2025-04-10 05:45:15 -07:00
Matias Fontanini
13ab57f7f6 fix: don't add extra space before heading if prefix is empty 2025-04-10 05:41:03 -07:00
Matias Fontanini
8c5cdf0a92
fix: use no typst background in terminal-* built in themes (#535)
This sets no background for typst renders in the terminal-light and
terminal-dark built in themes. This requires a reasonably recent version
of typst (probably 0.12+) as they changed the meaning of `none` as a
fill background at some point around then.
2025-04-03 16:38:56 -07:00
Matias Fontanini
a060afff7e fix: use no typst background in terminal-* built in themes 2025-04-03 16:34:40 -07:00
Matias Fontanini
58a3ea5b8d
feat: add fade slide transition (#534)
This adds another animation: `fade`. This essentially draws the new
slide on top of the current one by jumping to cells that have changed
between slides randomly and printing their contents.


https://github.com/user-attachments/assets/eb2d7d68-9967-4855-a06b-cbe208b21c6f

Fixes #364
2025-04-03 16:29:35 -07:00
Matias Fontanini
8b0677e418 feat: add fade cells slide transition 2025-04-03 16:26:38 -07:00
Matias Fontanini
e287624595
fix: fixing the external_snippet test error (#533)
The absolute path to the temporary directories has been replaced with
the path specified in the environment variables.
2025-04-02 17:34:23 -07:00
Sergey Savelev
e8901b2aa2 fix: fixing the external_snippet test error
The absolute path to the temporary directories has been
replaced with the path specified in the environment variables.
2025-04-02 19:06:27 +04:00
Matias Fontanini
81747f7f1d
fix: respect extends in a theme set via path in front matter (#532)
This fixes an issue where a presentation with a `theme.path` in the
front matter that pointed to a theme that contained an `extends`
wouldn't have its `extends` respected.
2025-04-01 17:44:44 -07:00
Matias Fontanini
8749daa537 fix: respect extends in a theme set via path in front matter 2025-04-01 17:06:37 -07:00
Matias Fontanini
33fd38313b
feat: add max_rows configuration to cap vertical size (#531)
Similar to `max_columns` this adds a `max_rows` and `max_rows_alignment`
(valid values are `top`, `center`, `bottom`, the default is `center`)
that cap the vertical presentation size and aligns it accordingly.
2025-04-01 16:52:34 -07:00
Matias Fontanini
4c00f7731f feat: add max_rows configuration to cap vertical size 2025-04-01 16:49:52 -07:00
Matias Fontanini
a30f78e2ed
feat: include images in slide transitions (#530)
This includes images when transitioning between slides; this was the one
detail remaining after #528. This could probably be made a bit more
efficient as it currently causes us to potentially read the image from
disk and decode it. In practice I don't know if it matters though so I'd
rather have this merged now and look at optimizations in the future if
needed.

In this implementation, images are turned into ascii via the ascii
printer and that is used during the transition. I don't think it's
viable/makes sense to print the actual image that many times just for
the transition.

Relates to #364


https://github.com/user-attachments/assets/1f5d13df-d928-4789-87ee-b73824728609
2025-03-30 13:29:48 -07:00