Skip to content

Commit 336b0ff

Browse files
committed
feat: slide number end
1 parent 6f60bc0 commit 336b0ff

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

README.md

+50-2
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,38 @@ Example:
562562
reveal.sh README.md --toc=false
563563
```
564564

565+
# Slide Number End
566+
567+
Slides after the specific slides
568+
569+
can be excluded from the **total slide number**.
570+
571+
---
572+
573+
Think about a situation where,
574+
575+
in your PhD defense,
576+
577+
there are several **backup slides** at the end.
578+
579+
You do not want them counted to the total slide number.
580+
581+
## `.slide-count-end`
582+
583+
Add `.slide-count-end` to the heading of the slide,
584+
585+
```md
586+
# Heading {.slide-count-end}
587+
```
588+
589+
## Example
590+
591+
In this README, `.slide-count-end` is added to slide [QnA].
592+
593+
Therefore, the slides after [QnA], like [Backup Slides]
594+
595+
are not counted to total slide number
596+
565597
# TOC (resident)
566598

567599
See,
@@ -651,7 +683,7 @@ you can control how many TOC columns you have.
651683
* The default `toc-margin` is `0 0 0 0`
652684
* Thus a 3-column toc is presented.
653685

654-
### 1-column TOC {.slide-count-end}
686+
### 1-column TOC
655687

656688
Here is an example of 1-column TOC
657689

@@ -660,10 +692,26 @@ toc-column-width: unset
660692
toc-margin: 0 400px
661693
```
662694

663-
# QnA
695+
# QnA {.slide-count-end}
664696

665697
* Problems?
666698
* tips?
667699
* Advice?
668700

669701
New issue and pull request is welcome!
702+
703+
# Backup Slides
704+
705+
Test the functionality of [Slide Number End].
706+
707+
From this slide on,
708+
709+
the total slide number ends counting.
710+
711+
## Level-2 Backup Slides
712+
713+
🐱
714+
715+
## Another Level-2 Backup Slides
716+
717+
🐈

bin/revealjs.sh

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ CMD=(
7979
"-V menu"
8080
"-V verticator"
8181
"-V showSlideNumber=all"
82-
"-V slideNumber='c/t'"
8382
"--slide-level=6"
8483
# table of content
8584
"--toc"

share/markdown_revealjs/template.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,17 @@ <h2 id="$idprefix$toc-title">$toc-title$</h2>
350350
// * h/v Horizontal / Vertical slide number
351351
// * c Flattened slide number, including both horizontal and vertical slides
352352
// * c/t Flattened slide number / total slides
353-
slideNumber: '$slideNumber$',
353+
slideNumber: slide => {
354+
slideEndCount = document.getElementsByClassName("slide-count-end")[0]
355+
// see reveal.js/js/controllers/slidenumber.js
356+
// Offset the current slide number by 1 to make it 1-indexed
357+
let horizontalOffset = slide && slide.dataset.visibility === 'uncounted' ? 0 : 1;
358+
return [
359+
Reveal.getSlidePastCount( slide ) + horizontalOffset,
360+
'/',
361+
Reveal.getSlidePastCount( slideEndCount ) + 1,
362+
];
363+
},
354364

355365
// 'all', 'print', or 'speaker'
356366
showSlideNumber: '$showSlideNumber$',

0 commit comments

Comments
 (0)