quarto-dev / quarto-cli

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

FR: Allow for presenter notes in Quarto presentations to be kept private #4318

Open kmasiello opened 1 year ago

kmasiello commented 1 year ago

I would like to figure out a way to make presenter notes for my Quarto presentations kept private and something I could add to my .gitignore. Perhaps the notes could be created in a child document that can be rendered with the main presentation, but I don't have to bare my soul (and all the reminders to myself) in the code of my actual slides.

cscheid commented 1 year ago

This is a really good request. I think the best way to do this for users would be to do it the other way around, by keeping a "private" file with the full contents, and generating a "public" .qmd file from it that doesn't include the presenter notes which can be used to create a webpage, etc.

At first I thought it was going to be easy, because we could simply render to gfm or markdown, and use a Lua filter to drop the divs. That doesn't really work because Pandoc doesn't guarantee a one-to-one mapping between your input markdown and the markdown it emits.

Although it's an incredibly ugly hack, I think the cleanest solution for this use case is to write a script that goes over the .qmd in text format, and catches things in between ::: {.notes} and the matching :::. You'll have to make sure that your notes aren't fancy (if they include eg nested divs that might need special treatment), but I imagine this would do the job for your use case.

cderv commented 1 year ago

If we are talking about keeping private in the HTML output presentation, then I just wanted to add that Quarto bundles by default the Multiplex extension and it will generate two HTML version of the presentation, one of them dedicated to be opened / browsed by viewer and so without any presenter note.

More at https://quarto.org/docs/presentations/revealjs/presenting.html#multiplex about those two files

This was confusing some user that the presentation they opened did not have speaker note because they opened the wrong HTML file as speaker (https://github.com/quarto-dev/quarto-cli/discussions/2263)

Multiplex would not be needed here maybe, but it offers such feature (that maybe we can look at doing without multiplex).

If we are talking indeed about having two versions of the .qmd then this comment is irrelevant above 😅 However, @cscheid not directly relevant to this but your comment make me think of something I discussed several times with users.

Although it's an incredibly ugly hack, I think the cleanest solution for this use case is to write a script that goes over the .qmd in text format, and catches things in between ::: {.notes} and the matching :::.

There was some other cases for which using a .qmd to generate another valid .qmd file with modified content desired. I recall it was for teaching material I think. I can try to explain or write about this. Just sharing here as it is slightly relevant. (using one .qmd to build 2 others .qmd)

cscheid commented 1 year ago

There was some other cases for which using a .qmd to generate another valid .qmd file with modified content desired.

I think I remember that. The technical difficulty is that we want two things that are incompatible:

  1. This kind of processing really wants to be in a Lua filter
  2. Lua filters go through Pandoc, which at present fundamentally cannot promise a "character-exact" round trip of markdown constructs.

So we're kind of stuck.

mcanouil commented 1 year ago

Would à Quarto project profile not work in this case? 🤔

::: {.notes .content-visible when-profile="speaker"}
This content will only appear in the advanced version.
::: 

Or

::: {.content-visible when-profile="speaker"}
:::: {.notes}
This content will only appear in the advanced version.
::::
:::
cderv commented 1 year ago

Thanks @mcanouil !

This seems like a good way to produce different HTML version with and with out the speaker notes. Using a project Lua filter to remove the DIV of class notes would work too.

It seems the issue here could be to provide another .qmd version without the speaker note.

Anyhow, I think we've covered different useful scenario here.

kmasiello commented 1 year ago

wow, really clever suggestions. I will need to experiment, but this sounds promising. Thank you!

ganong123 commented 1 month ago

Chiming in that I also would find this feature super helpful. We post qmd slides for our students so they can run the code in real time during lecture, but at the same time, we have speaker notes which are just for instructors which we don't want to post. That said, ChatGPT can quickly and easily write a version of the manual script suggested by @cscheid