gnab / remark

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

Fixing the issue with `count: false` on the first slide #619

Closed peterj closed 4 years ago

peterj commented 4 years ago

This issue reproed only if the first slide has count: false - we have a unit test that was passing when the count:false is not on the first slide. However, adding count: false to the first slide, fails the test.

Let's assume we have the following slides:

count:false

Slide A
---
Slide B

When we parse the slides we check if the slide is included (based on the classes) and if it's not a layout slide as well as if it should be counted. The code inside the if statement does not execute, so the slides.byNumber[slideNumber] is undefined

if (slideIsIncluded && slide.properties.layout !== 'true' && slide.properties.count !== 'false') {
      slideNumber++;
      slides.byNumber[slideNumber] = [];
}

Later though, we call slides.byNumber[slideNumber].push(slideViewModel); and that's what's causing the issue.

This fix adds a check for undefined on slides.byNumber[slideNumber] before calling .push on it.

Resolves #613

dvberkel commented 4 years ago

The changes look good to me