deathbeds / jupyterlab-deck

Lightweight presentations for JupyterLab
https://jupyterlab-deck.rtfd.io
BSD 3-Clause "New" or "Revised" License
41 stars 9 forks source link

Add markdown presenter #19

Closed bollwyvl closed 2 years ago

bollwyvl commented 2 years ago

Elevator Pitch

Add a basic presenter for markdown slides viewed in the Markdown Preview activity.

Motivation

.md files should make fine slides.

Design Ideas

The specs for markdown and commonmark allow for several syntaxes for horizontal rules, and these are commonly used for tools such as marp and others.

Without supporting all the features, we can probably fiat hrs (written with ---) as slides. The ~ operator can be used to select stuff between multiple as-rendered hr elements.

bollwyvl commented 2 years ago

To expand on the above, given the id of the markdown viewer widget:

Or, once the presenter gets to work

body[data-jp-deck-mode="presenting"] :not(.lm-mod-hidden) .jp-MarkdownViewer > * {
  display: none;  // or equivalent
}
body[data-jp-deck-mode="presenting"] :not(.lm-mod-hidden) .jp-MarkdownViewer hr:nth-of-type(1) ~ :not(hr:nth-of-type(2) ~ *):not(hr)') {
  display: block; // or equivalent
}

This could be tightened up by annotating the leading hr element with .e.g jp-deck-mod-onscreen, so that the CSS isn't changing as frequently, though it will be a full repaint anyway when changing the classes.