Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: a mechanism to specify which clicks should be exported on a per-slide basis #1732

Open
DavidAntliff opened this issue Jul 4, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@DavidAntliff
Copy link

DavidAntliff commented Jul 4, 2024

Apologies if I've missed an existing feature request for this, I did search for one and didn't find anything relevant.

When exporting, without --with-clicks, the docs say:

By default, Slidev exports one page per slide with clicks animations disabled.

From what I can tell, this is (always?) the last "click" for each slide. This is not always the most useful representation of a slide and it is sometimes useful to export an earlier click on that slide.

Also, it is sometimes useful to have a few of the click states rendered on selected slides, but not all of them (for example in a lengthy magic-move sequence). Additionally, it may be useful to have some slides optionally omitted from the export (perhaps due to sensitive data).

A concrete example is a before/after "refactoring" slide, where, say, some "bad" code is shown on the first click, and then magic-move is used over, say, 20 animated steps, to work towards the final click which shows the "good" version of the code, and in the final export perhaps only the first and last clicks are actually useful in a PDF.

I propose a way to specify, for a specific slide (perhaps in the YAML frontmatter for the slide), the click or clicks that will be rendered to PDF when --with-clicks is not provided.

For example:

By default, the current behaviour for each slide continues, but for this page that has a, say, export: OnClicks: entry:

---
export:
  forClicks: 1-3,*
---

# My Slide

<v-clicks>
* one
* two
* three
* four
* five
</v-clicks>

When export is run with --with-clicks, the PDF would contain pages only for click states 1, 2, 3 and the final slide state for this specific page.

The forClicks field could take individual click numbers (e.g 1), ranges (3-5), sequences delimited by ,, and the special * to indicate the final click on that page, whatever that might ultimately be.

This would also allow pages to be skipped from the export if the forClicks: value is empty/null.


Since the default behaviour would remain unchanged, this would be a purely opt-in feature, and not affect any existing presentations.

A workaround is to use the --with-clicks to render all click states and then remove the superfluous pages. This is actually really tedious. To do this in my real presentation I end up with over 700 slides and have to manually remove 550 of them to get the set I want.

@DavidAntliff DavidAntliff added the enhancement New feature or request label Jul 4, 2024
@DavidAntliff DavidAntliff changed the title A mechanism to specify which clicks should be exported on a per-slide basis Feature Request: a mechanism to specify which clicks should be exported on a per-slide basis Jul 4, 2024
@KerstinKeller
Copy link

I am just exporting my slides, and agree that this would be very helpful.

@antfu
Copy link
Member

antfu commented Nov 20, 2024

I agree it makes sense and the technically side it should be possible. But I see the problem more like how we should design the syntax. Any proposals/ideas?

@DavidAntliff
Copy link
Author

Any proposals/ideas?

Yes, see above...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants