Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Feature request: Presentation mode

Open dpsanders opened this issue 4 years ago β€’ 35 comments

It would be fantastic to have a presentation mode like RISE for Jupyter notebooks:

https://rise.readthedocs.io/en/stable/

Basically it would convert the notebook into a live presentation.

dpsanders avatar May 20 '20 05:05 dpsanders

Yes that would be cool!

My current idea to use h1 and h2 tags as slide delimiters (that's # or ## in markdown). There would be a presentation mode, which does nothing except add a large margin above every h1 or h2 tag, and some buttons to jump between them.

fonsp avatar May 20 '20 18:05 fonsp

You might see it in action next week!

fonsp avatar May 20 '20 18:05 fonsp

You need to write present() in the browser console to activate it, I will add a button later :)

fonsp avatar May 21 '20 15:05 fonsp

I get

present()
VM148:1 Uncaught ReferenceError: present is not defined
    at <anonymous>:1:1

dpsanders avatar Jun 11 '20 03:06 dpsanders

I took it out again 😬 but I can easily add it back in if you like? I just noticed that Markdown-only slides are a bit limiting, you need to write a bit of HTML and CSS to make things look more flashy.

For example, I wrote a two_columns(md"I am on the left", md"I am on the ![](right.png)") function - I can send that too!

fonsp avatar Jun 11 '20 10:06 fonsp

I'd definitely like to have a go to see if it's usable!

dpsanders avatar Jun 11 '20 13:06 dpsanders

I've added it to 0.9.8 - with the same hack to activate it :)

fonsp avatar Jun 11 '20 13:06 fonsp

Great, thanks!

dpsanders avatar Jun 11 '20 14:06 dpsanders

Could you describe what the hack is to start a presentation?

briochemc avatar Jul 08 '20 06:07 briochemc

Open the Javascript console in your browser (developer tools) and type present() there.

dpsanders avatar Jul 08 '20 07:07 dpsanders

Of course! For the record, I got confused because, on Firefox, there is a Web console and a Browser console, and present() can only be typed and work in the Web console...

briochemc avatar Jul 08 '20 08:07 briochemc

@briochemc Could you let us know what you think about the presentation mode after you have tried it out?

fonsp avatar Jul 08 '20 10:07 fonsp

My three cents up to now:

  • Maybe increase the size to match the screen width when in presentation mode? I think something like is done by Remark could be a good guide?
  • Use or h3 or even h4 as markers to split between slides? Or maybe have it in the present function, i.e., something like `present(h3) would mark anything h3 or higher as a slide separator?
  • As mentioned in https://github.com/fonsp/PlutoUI.jl/issues/11, showing values next to sliders for presentations would be a nice feature!
  • Being able to "recall" a slider is useful. For example, when you want to change a variable with a slider that was defined a few slides before. But I noticed the sliders are not synced then, as in this MWE (cell 1 creates slider, cell 2 "recalls" the slider, cell 3 shows its value): Screen Shot 2020-07-10 at 12 18 05 pm I can change the value of x by moving either slider. But it is a bit annoying that the other slider does not update its position (as you can see they are not synced). Maybe that's intended though?

briochemc avatar Jul 10 '20 02:07 briochemc

Thanks! 3 and 4 are useful for Pluto in general, I have added them to the suggestion box.

1 and 2 might be nice to have, but I think a bigger issue is that slides written in md"" are just not exciting enough. (That's why this is still a hidden feature.) What could be added to make slides more attractive?

Remark looks fun, but it's not trivial to integrate with Pluto

fonsp avatar Jul 11 '20 15:07 fonsp

FYI, I just mentioned remark for inspiration for the sizing (font size and spacing), but I guess there are plenty of other sources of inspiration out there, like, e.g., RISE. And 2 was because I felt like I had to manually zoom in on my browser to get a good font size, but then the h1 and h2 titles seemed too big.

BTW, I should mention that Pluto already looks great anyway! πŸ˜ƒ

briochemc avatar Jul 12 '20 02:07 briochemc

note to self: the autoscrolling should be disabled in presentation mode

fonsp avatar Aug 19 '20 17:08 fonsp

You need to write present() in the browser console to activate it, I will add a button later :)

you don't have to, users can do it by themselves.

present

Yep, now I can play presentations on my cell phone browser!

GiggleLiu avatar Aug 22 '20 13:08 GiggleLiu

note to self: the autoscrolling should be disabled in presentation mode

I find it quite useful to allow autoscrolling when you want to demonstrate a long example. I think it is a feature rather than a flaw. It will be nicer to have an argument in present function to allow both modes.

In RISE, when the content overflows, the display looks terrible. Overflow can happen when you try to zoom the page, trigger a long error message or change your display device to one with a smaller screen.

When you scroll, you don’t have the overflow issue.

GiggleLiu avatar Aug 23 '20 04:08 GiggleLiu

I love this feature. Two questions:

  1. Is there a function to exit (e.g. unpresent())?
  2. Can I put in a pause in the middle of a slide to gradually uncover cells?

AsafManela avatar Aug 26 '20 17:08 AsafManela

  1. Is there a function to exit (e.g. unpresent())?

Call present() again to exit.

GiggleLiu avatar Aug 27 '20 00:08 GiggleLiu

2. Can I put in a pause in the middle of a slide to gradually uncover cells?

No, but you can copy paste the same slide a couple of times, and delete parts of it

fonsp avatar Aug 27 '20 10:08 fonsp

Are we satisfied with the current presentation mode? Then I'll add a button in the export menu

fonsp avatar Aug 27 '20 10:08 fonsp

2. Can I put in a pause in the middle of a slide to gradually uncover cells?

No, but you can copy paste the same slide a couple of times, and delete parts of it

That's certainly a workaround. Just requires a bit of code replication I was hoping to avoid.

I can open another issue with this feature request.

AsafManela avatar Aug 27 '20 15:08 AsafManela

one idea is when rendering a cell in presentation mode, if it has multiple ## under #, put them in separate slides when presenting

Moelf avatar Aug 27 '20 15:08 Moelf

What I had in mind is like RISE's feature for fragment cells

AsafManela avatar Aug 27 '20 21:08 AsafManela

@Moelf what do you mean? this sounds like the current behavior

@AsafManela that sounds like something that an external package/code should do

fonsp avatar Aug 28 '20 04:08 fonsp

you're right

Moelf avatar Aug 28 '20 04:08 Moelf

@fonsp would you mind sharing the functions you used for layouting your JuliaCon presentation?

p-gw avatar Sep 11 '20 13:09 p-gw

nice to hear about that.

jinjunsun avatar Nov 04 '20 06:11 jinjunsun

Instructions

@andreasKroepelin wrote a wonderful guide about this feature:

https://andreaskroepelin.de/blog/plutoslides/

EDIT september 2023

You can now also keyboard arrows to move betweel slides (#2611) and there is a button to toggle presentation mode (#2660).

fonsp avatar Jan 16 '21 14:01 fonsp

It would be nice to be able to show the slide number next to the control buttons, in the corner of the screen. That could be made optional, of course.

schneiderfelipe avatar Mar 28 '21 22:03 schneiderfelipe

Regarding the presentation mode in Pluto, one particular point does not seem very convenient (if I am not missing some specific functionality in Pluto). When one increases the size of the display (Ctrl +) in Windows --- and with no Table of Contents (by mere option) and without the Live docs window (removed by the presentation mode) --- the Pluto display window keeps moving further to the left of the monitor. In this case, there will be a large area on the right-hand side of the monitor that will be left idle. Why not allowing the Pluto display to be seen in the center of the monitor if there are no Table of Contents neither Live docs on the right-hand side?

If we are presenting the materials online, there will be no problem (for obvious reasons). But if we are going to use a Pluto notebook in a classroom, I think this particular point may be unappealing to students.

VivaldoMendes avatar May 13 '21 17:05 VivaldoMendes

For anyone who wants to go (forward / back) a slide by right/left clicking anywhere (that isn't an interactive component), I'm using this small snippet:

SlideNextPrev() = @htl("""
<script id="first">

	var editor = document.querySelector("pluto-editor")
	var prev = document.querySelector("button.changeslide.prev")
	var next = document.querySelector("button.changeslide.next")
	
	const click_background = (e => {
		// debugger;
		if (editor != e.target) return;
		e.preventDefault();		
		console.log(e.button);
		if (e.button === 2 && prev) {
			prev.click();
		} else if (e.button === 0 && next) {
			next.click();
		} 
	})
	editor.addEventListener("click", click_background)
	editor.addEventListener("contextmenu", click_background)

	invalidation.then(() => { 
		editor.removeEventListener("click", click_background);
		editor.removeEventListener("contextmenu", click_background);
	})
	
	return true;
</script>
""")

~~EDIT: I forgot how to make pluto forget the event listeners when the object disappears. This will add too many listeners, when ran multiple times. so uh, beware!~~ EDIT 2: Updated to the latest pluto and (re)found the nifty invalidation variable

KingBoomie avatar May 11 '22 17:05 KingBoomie

Is there a keyboard shortcut to go forward - backward? If not, is it possible to define one myself?

gdalle avatar May 23 '22 15:05 gdalle

I don't know if anyone else has this problem, but the navigation buttons are not working in my machine.

rgouveiamendes avatar Jun 07 '22 16:06 rgouveiamendes