quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.95k stars 326 forks source link

[Feature Request] revealjs: Ability to choose the level of progressive reveal for `incremental` lists #10467

Open gadenbuie opened 3 months ago

gadenbuie commented 3 months ago

In revealjs Quarto presentations, you can use .incremental to progressively reveal a list:

::: {.incremental}
* Apple
  * liquid
    * juice
    * cider
  * solid
    * pie
* Banana
  * bread
  * pudding
:::

In the presentation, each item in the list, regardless of its depth in the list, will be revealed one at a time. First Apple, then Apple and liquid, then Apple, liquid and cider, etc.

I've often wanted to have the progressive reveal happen only up to a specific level. For example

::: {.incremental incremental-level=1}
* Apple
  * liquid
    * juice
    * cider
  * solid
    * pie
* Banana
  * bread
  * pudding
:::

Would reveal first Apple along with any of its sub-items and second Banana with it's sub-items. Similarly,

::: {.incremental incremental-level=2}
* Apple
  * liquid
    * juice
    * cider
  * solid
    * pie
* Banana
  * bread
  * pudding
:::

would group anything below the 2nd level list items into a single reveal, so in this case Apple would reveal first, followed by liquid and its sub-items, followed by solid and its sub-items., then the same for Banana.

cderv commented 2 months ago

Thanks for the suggestion.

By any chance, did you try to write the HTML code that would make this work based on revealjs Fragment feature ?

Just curious. I wonder if the Fragment order only would make this work.

Also, just a note. The incremental feature is not a Quarto feature. It is a Pandoc feature : https://pandoc.org/MANUAL.html#incremental-lists

So I believe adding such feature would mean taking over in Lua the incremental feature that lives currently in Pandoc's HTML writer. Unless we manage to do this using some HTML post processing.

gadenbuie commented 2 months ago

Also, just a note. The incremental feature is not a Quarto feature. It is a Pandoc feature : pandoc.org/MANUAL.html#incremental-lists

Ah, that makes sense, I hadn't realized this, sorry! I think my idea is a good one, but might be better suited as a revealjs extension than a fundamental change to how incremental works.

cderv commented 2 months ago

be better suited as a revealjs extension

Totally. Revealjs extension are another way to solves this with post processing in the browser directly when slides are loading.