gnab / remark

A simple, in-browser, markdown-driven slideshow tool.
http://remarkjs.com
MIT License
12.66k stars 855 forks source link

pure template slides? #386

Open sinedied opened 7 years ago

sinedied commented 7 years ago

Except if I'm missing something from the docs, it would be nice to define slides with the sole purpose to be templates for other slides (ie hidden from the presentation but usable as templates).

I thought I could use exclude: true for the purpose, but when using this option it does not work as a template anymore :(

Maybe the simplest way would be to allow excluded slides to be used as template, what do you think?

gnab commented 7 years ago

You can do this by setting the slide property layout: true. This automatically makes it the template for all subsequent slide until you 1) specify layout:false to stop using the current layout slide, or 2) specify a new layout slide that will take over from that point and on, or 3) you explicitly specify a different template slide only for the specific slide in question, using template: <name-of-other-slide>.

So you can define and use your pure template slides like this:

layout:true
name:pure-template-1

Some template content

---
layout: true
name:pure-template-2

Some other template content

---
layout:false

# First normal slide, no template
---
template: pure-template-1

# Second normal slide, pure-template-1
---
template: pure-template-2

# Third normal slide, pure-template-2

Check out a live demo.

sinedied commented 7 years ago

The option layout: true is nice, but in this case it would be nice to have a separate option for the default slide then, because it has 2 flaws the way it works currently:

  1. the default slide you want for all your slides must be last, where you would logically want it first
  2. your template just inherit variables and template from the default slide, because they override it with the layout option
Kaligule commented 5 years ago

I agree that this would be usefull. It feels a bit like a hack this way.

So what would be a better way to have a layout page that isn't shown by itself? I could imagine these keywords:

  1. pure_layout-keyword for a page that is layout no slide on its own.
  2. skip-keyword for a slide that should not be shown. (This keyword shouldn't be inherited)
  3. A possibility to define layouts before the textarea starts.
utdrmac commented 5 years ago

As part of this discussion, I think it would be "neato" to be able to include a "templates.md" file which, much like a CSS file, could define multiple templates to be used by any slide at any time. If a slide does not have one specified, it uses the previous slide's template.