Is there a simple way to make all cells in a notebook into slides? Currently I am using the cell toolbar to do this, and it means I need to go to each cell and set Slide type=Slide. I was wondering if there was a way to do this globally for all cells in a notebook?
You can probably write a script to set up the metadata of each cell to be slide_type=slide.
There is currently no mechanism on RISE to do that.
You can add this in your jupyter's custom.js
define(
['base/js/namespace',
'base/js/events'
],
function(Jupyter, events) {
// mark individual cell
function set_slide(cell, bool) {
let metadata = cell.metadata;
if (metadata.slideshow === undefined){
metadata.slideshow = {};
}
metadata.slideshow.slide_type = bool ? 'slide' : undefined;
}
// mark all cells as Slide
function mark_all_cells_as_slide() {
Jupyter.notebook.get_cells().forEach(function(cell) {
set_slide(cell, true);
});
// need to update the slideshow toolbar to reflect changes
Jupyter.CellToolbar.rebuild_all();
}
// actually bind to a keyboard shortcut
Jupyter.keyboard_manager.command_shortcuts.add_shortcut(
'shift-z', // or alt-z or meta-z or similar
{ help : 'set the Slide tag on all cells',
handler: mark_all_cells_as_slide,
})
})
Nice! We should put this into the docs, or maybe, even better, put it inside RISE somehow.
OK sure, if you think it's helpful;
personnally I do not think I would use this very often though
OTOH I do have keyboard shortcuts to deal with the slide_type on the selected cell only:
another very useful one for me is
Jupyter.notebook.get_cells().forEach(function(cell){cell.render();})
I can easily shove all this into RISE and turn these into actions, if there's interest
OTOH Im almost certain that my choice for the shortcuts is going to trigger endless discussions, so we could leave it to users to use set_shortcut like illustrated in #291 to make their own choice of keyboard mapping
personnally I do not think I would use this very often though
Maybe a mention/code example in the docs is OK, I agree.
OTOH I do have keyboard shortcuts to deal with the slide_type on the selected cell only:
That is very interesting and it was requested in the past here: https://github.com/damianavila/RISE/issues/114
I can easily shove all this into RISE and turn these into actions, if there's interest
I am interested :wink:
OTOH Im almost certain that my choice for the shortcuts is going to trigger endless discussions, so we could leave it to users to use set_shortcut like illustrated in #291 to make their own choice of keyboard mapping
Sure.
@parmentelat thank you so much. This is very helpful.
@damianavila It would be lovely if we have these as keyboard actions. Please.
Most helpful comment
@parmentelat thank you so much. This is very helpful.
@damianavila It would be lovely if we have these as keyboard actions. Please.