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

Support for RISE slides #792

Open
2 tasks
nthiery opened this issue Jul 16, 2020 · 25 comments
Open
2 tasks

Support for RISE slides #792

nthiery opened this issue Jul 16, 2020 · 25 comments
Labels
complexity: medium Could be accomplished in a single pull request over a few days once ready to implement enhancement New feature or request 🏷️ MyST-NB state: needs discussion Needs discussion before implementation can happen

Comments

@nthiery
Copy link

nthiery commented Jul 16, 2020

Description

RISE is a Jupyter extension that lets you define reveal.js presentations with Jupyter Notebooks. It would be useful if, when Jupyter Book builds a book with a notebook that is "a RISE notebook", that the notebook would be presented in the book as a RISE presentation, instead of a static page of content.

Bonus:

  • Enable both slide and standard view (as in nbviewer), with default view set according to RISE's configuration option in the notebook.
  • Special rendering of notes cells in standard view. For now, I am embedding the text in each cell in a directive:
    ```{note}
    ```
    
    It would be nice to have such a directive on by default, with title "Speaker notes".

Benefit

RISE is a very popular extension in Jupyter and has been around for a long time. Integrating it with Jupyter Book would offer a nice opportunity for a different pattern of reader interaction, and would support the many notebooks that are already built for RISE presentations.

Implementation

Notebooks are currently parsed by MyST-NB, so this is likely where the change would be. When that parsing is done, the outcome is a docutils doctree. This is the "state of the content" when Jupyter Book builds outputs.

One option would be to build a Sphinx extension that would know how to turn doctree objects with certain metadata into RISE slideshows on the current page.

Another option would be to add logic to MyST-NB so that if a RISE notebook is encountered, the RISE assets would also be generated and bundled with the output website, and these assets could be activated from within the page.

Tasks to complete

  • Understand the right pattern of user interaction on a page
  • Work out implementation details
@nthiery nthiery added the enhancement New feature or request label Jul 16, 2020
@choldgraf
Copy link
Member

How do you imagine incorporating RISE slides into a book? Like, you'd click a link in the sidebar and then it's just take you to a RISE presentation? Or do you want to generate a full RISE presentation for your book itself?

@nthiery
Copy link
Author

nthiery commented Jul 16, 2020 via email

@firasm
Copy link
Contributor

firasm commented Jul 17, 2020

I also teach with Jupyter RISE and this would be a game changer for me!

If it helps, here's a demo of it in action with binder: https://mybinder.org/v2/gh/damianavila/RISE/master?filepath=examples%2FREADME.ipynb.

The thing that I can't wrap my head around is how to retain the ability to still code in the cells inside the RISE presentation. I don't think that can be done on the web server, that needs to be a binder/thebelab thing. In other words, seeing just the slides seems doable with an html export of the presentation and then serving it. Tricky part is the coding inside the presentation

@nthiery
Copy link
Author

nthiery commented Jul 17, 2020 via email

@choldgraf
Copy link
Member

choldgraf commented Jul 17, 2020

Yeah I think the question here is one of division-of-labor. e.g., right now there is nothing in jupyter-book that depends on nbconvert, and I'm not sure whether we want to add that as a dependency. But, perhaps a path forward is to have a Sphinx extension that creates RISE presentations from notebooks (maybe even MyST Markdown notebooks?) and then document how to use that extension with Jupyter Book? There are also other issues to figure out like "would the RISE presentation need to take up the whole screen or could/should it still exist within the content window etc"

@nthiery
Copy link
Author

nthiery commented Jul 17, 2020 via email

@choldgraf
Copy link
Member

Cool - I think a tricky question is whether the RISE assets should be a part of the Sphinx toctree itself, or just a set of assets that users can link out to via, e.g., a directive in their Sphinx pages. I think that the latter might be simpler to start with.

@chrisjsewell
Copy link
Member

chrisjsewell commented Jul 17, 2020

Just going to link this issue to executablebooks/meta#52 😄

@choldgraf
Copy link
Member

A quick update here - I just played around with embedding content via <iframe> elements and think that this could be a relatively easy way to get RISE slideshows working in Jupyter Book without changing any of the underlying code. For an example of embedding a RISE presentation in a different Sphinx website, see here

https://predictablynoisy.com/jupyter-multi-book

and click the "RISE" link at the top. Here's a comment w/ explanation:

#1037 (comment)

In principle this could work the same way with Jupyter Book - just use an <iframe> element in one of your book's pages to embed a local RISE presentation, and it should embed nicely into the content.

Curious what others think about this

@firasm
Copy link
Contributor

firasm commented Oct 13, 2020

Thanks @choldgraf ! I agree that this is nice and may work in some/most cases.

The "killer" feature of RISE though, is to edit the presentation live and run jupyter notebook cells - I don't think the iframe solution can do this, can it ? When I tried this a few weeks ago there was no kernel attached because the slides were being run as HTML files.

@nthiery
Copy link
Author

nthiery commented Oct 13, 2020 via email

@choldgraf
Copy link
Member

Yep you're right that executing the RISE presentations would still require a live kernel, which Jupyter Book doesn't provide by default.

I suspect that the best way to support this would be to support Thebe within RISE, rather than to try and piggy-back on Jupyter Book...it definitely should be doable but would require some new development

@jedbrown
Copy link

@choldgraf In your demo, the figures are not displayed (somewhat contrary the text of the slides). It looks like this may just be that we'd need jupyter-nbconvert --execute. Is the idea that promoting this feature from the Makefile to JB would make caching cleaner/more reliable?

I use RISE (with splitcell and hide_code) in class (with a live kernel) and would love to be able to render the static result in an iframe of the class website. I know it won't have a live kernel, but Altair plots can still be interactive, for example. (I use altair-plot from Sphinx/MyST in other contexts and it works great, but it's work to extract a notebook intended for RISE slides to a good narrative page with those interactive figures.) I'd also just like to be able to place slides for talks on my website and have an adequate user experience without needing to click through to Binder.

@choldgraf
Copy link
Member

Mmm i don't think i quite understand what you're suggesting. I don't have much experience with rise so may not be the best person to ask. Perhaps @damianavila has thoughts?

@atantet
Copy link

atantet commented Aug 19, 2021

FYI, in the Scikit-Learn Course jupyter-book, slides are embedded with iframe in the markdown files. See for example: https://inria.github.io/scikit-learn-mooc/overfit/learning_validation_curves_slides.html

This yaml file appears to configure the continuous integration making the slides : https://github.com/INRIA/scikit-learn-mooc/blob/c1158f6492dfd8a8865b24e0268b4bc9a9c02d30/.github/workflows/slides.yml

It is based on the remarker Python package, "a command line tool for generating Remark.js presentations from markdown files.".

This solution does not have the same purpose as RISE, but it could be nice to have it implemented as an alternative (just sharing the yaml continuous integration file with some doc?) or at least give some inspiration.

@damianavila
Copy link

damianavila commented Aug 25, 2021

Several thoughts here 😉 ...

IMHO, there is one important distinction to make to prevent confusion: RISE deals with live (executable) slideshows, it is a JS notebook extension based on reveal.js and is able to turn a notebook view into a slideshow view. On the other hand, we have support for static reveal.js slides in nbconvert. There, we can convert ipynb files into HTML static slideshow that resemble RISE slides but are NOT executable.

For the Jupyter Book use case, I can foresee different slideshow approaches:

  1. Support for launching from Jupyter Book into a RISE live/executable slideshow (maybe local kernel/server, maybe remote kernel/server)
  2. Showing a static (non-executable) nbconvert-created slideshow
  3. Start as static but then make it live (a la Thebe, not yet developed)
  4. RISE (actually, a RISE lab incantation) on JupyterLite + JupyterBook, so you have a live/executable slideshow but without any server behind 😉
  5. And I am probably missing some other ideas...

@chrisjsewell
Copy link
Member

chrisjsewell commented Aug 25, 2021

Thanks @damianavila, was meaning to pick your brains about this; you being the author of RISE and all! https://github.com/damianavila/RISE.
It definitely feels like slideshows would be a cool and hopefully useful feature, if we could get it working in a relatively intuitive way

@jedbrown
Copy link

Thanks @damianavila I envision 2 with either 3 or 4 eventually. (I think 4 is the future, but 3 might help get us there by creating demand for 4.) But 2 needs some integration and there are outstanding issues with nbconvert not supporting static things that I use a lot in RISE (splitcell, hide-code, chalkboard).

@nthiery
Copy link
Author

nthiery commented Aug 26, 2021

Thanks @damianavila for clarifying! As @jedbrown, I believe 2 is the most pressing one, so that readers can at least browse through the static documents in a layout similar to their counterpart live view within Jupyter. 3 would be nice to have for simple interactivity. The others too, but they apply to all Jupyter notebook equally, not just slides.

@choldgraf choldgraf added state: needs discussion Needs discussion before implementation can happen 🏷️ MyST-NB complexity: medium Could be accomplished in a single pull request over a few days once ready to implement labels Aug 28, 2021
@MoritzImendoerffer
Copy link

MoritzImendoerffer commented Oct 24, 2021

Some thoughts while preparing lecture notes using jupyter-book and jupyter-lab. Would it be possible with such an extension, to use those two tools for following workflow?

  • Create a jupyterbook with a lot of text etc. However, the slide type for each cell is set to "skip"
  • Create slides with very little text but add a "remove-output" and "hide-input" tag as well as slide type "slide" or "note"

This way, an interactive slide deck could theoretically live inside a juypter-book. Not sure if this would be overengineered in practice but right now it seems like a good workflow.

@firasm
Copy link
Contributor

firasm commented Oct 24, 2021

Hi @MoritzImendoerffer I don't think that's over-engineered at all.

In fact, I do something similar already with my lecture notes/slides. The advantage is that you can embed long prose sections for additional explanation/context into your jupyter notebook for pre-reading or post-reflection. During class, we go through the executable portions of the notebook and now my "textbook" (via notebook) and "lecture slides" (via RISE) are linked in one place and provided to students using a jupyterbook.

There are definitely inefficiencies, the most annoying of which is setting the cell tags manually - but I can't think of an automatic way to do this, so perhaps that's for the best.

@firasm
Copy link
Contributor

firasm commented Oct 24, 2021

On another note, just wanted to link to this potentially exciting future development of thebe: adding pyodide as a kernel backend for thebe, which would allow us to get 1 and 4 from @damianavila's comment above!!

@nthiery
Copy link
Author

nthiery commented Oct 25, 2021

In fact, I do something similar already with my lecture notes/slides ...

Same here. It's very convenient to have the same document support both
interactive lectures (slides) and asynchronous work (notebook), including
pre-reading, post-reflection, and also flipped classroom if not lecture-free
training. And that both the author (teacher) and reader (student) can choose
which view they want depending on their current use. Hence it would be nice
if the reader had the same choice for the static web view.

There are definitely inefficiencies, the most annoying of which is setting the cell tags manually - but I can't think of an automatic way to do this, so perhaps that's for the best.

Two things that would help much in this regard:

  • in the notebook view: select a range of slides, and set the cell type for all of them at once
  • in the slides view: change the current cell type on the fly without having to come back to the notebook view

@nthiery
Copy link
Author

nthiery commented Oct 25, 2021

For the record: I made a quick attempt with jupyter lab: you can select a range of
cells, then choose the cell-slide-type in the property inspector. But it seems to
only change the current cell; not all the cells in the range.

@kaivogelgesang
Copy link

I hacked together a proof of concept for 2. It works on the generated HTML dom elements, so it should support MyST-Markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: medium Could be accomplished in a single pull request over a few days once ready to implement enhancement New feature or request 🏷️ MyST-NB state: needs discussion Needs discussion before implementation can happen
Projects
None yet
Development

No branches or pull requests

9 participants