Skip to content

Commit

Permalink
Merge pull request #10998 from quarto-dev/revealjs/jump-to-slide
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv authored Oct 7, 2024
2 parents e3d832c + a6dac9f commit fcd7abb
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
1 change: 1 addition & 0 deletions news/changelog-1.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All changes included in 1.6:
## `revealjs` Format

- Update to Reveal JS 5.1.0.
- Support for a [Jump To Slide](https://revealjs.com/jump-to-slide/) menu to quickly navigate between slides. Set `jump-to-slide: false` to opt out.
- Prevent empty SASS built css file to be included in header.
- Remove wrong `sourceMappingUrl` entry in SASS built css.
- ([#7715](https://github.com/quarto-dev/quarto-cli/issues/7715)): Revealjs don't support anymore special Pandoc syntax making BulletList in Blockquotes become incremental list. This was confusing and unexpected behavior. Supported syntax for incremental list is documented at <https://quarto.org/docs/presentations/revealjs/#incremental-lists>.
Expand Down
1 change: 1 addition & 0 deletions src/format/reveal/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export const kAutoAnimateDuration = "autoAnimateDuration";
export const kAutoAnimateUnmatched = "autoAnimateUnmatched";
export const kAutoStretch = "auto-stretch";
export const kCodeBlockHeight = "code-block-height";
export const kJumpToSlide = "jumpToSlide";
4 changes: 4 additions & 0 deletions src/format/reveal/format-reveal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
kCenterTitleSlide,
kControlsAuto,
kHashType,
kJumpToSlide,
kPdfMaxPagesPerSlide,
kPdfSeparateFragments,
kPreviewLinksAuto,
Expand Down Expand Up @@ -142,6 +143,9 @@ export function revealjsFormat() {
format.metadata[kAutoAnimateUnmatched] !== undefined
? format.metadata[kAutoAnimateUnmatched]
: true,
[kJumpToSlide]: format.metadata[kJumpToSlide] !== undefined
? !!format.metadata[kJumpToSlide]
: true,
};

if (format.metadata[kPdfMaxPagesPerSlide]) {
Expand Down
19 changes: 14 additions & 5 deletions src/format/reveal/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

import { Metadata } from "../../config/types.ts";
import { camelToKebab, kebabToCamel } from "../../core/config.ts";
import {
kAutoAnimateDuration,
kAutoAnimateEasing,
kAutoAnimateUnmatched,
kJumpToSlide,
kPdfMaxPagesPerSlide,
kPdfSeparateFragments,
} from "./constants.ts";

export function optionsToKebab(options: string[]) {
return options.reduce(
Expand Down Expand Up @@ -80,9 +88,9 @@ const kRevealOptions = [
"preloadIframes",
"autoAnimate",
"autoAnimateMatcher",
"autoAnimateEasing",
"autoAnimateDuration",
"autoAnimateUnmatched",
kAutoAnimateEasing,
kAutoAnimateDuration,
kAutoAnimateUnmatched,
"autoAnimateStyles",
"autoSlide",
"autoSlideStoppable",
Expand All @@ -108,9 +116,10 @@ const kRevealOptions = [
"minScale",
"maxScale",
"mathjax",
"pdfMaxPagesPerSlide",
"pdfSeparateFragments",
kPdfMaxPagesPerSlide,
kPdfSeparateFragments,
"pdfPageHeightOffset",
kJumpToSlide,
];

const kRevealKebabOptions = optionsToKebab(kRevealOptions);
17 changes: 17 additions & 0 deletions tests/docs/smoke-all/revealjs/jump-to-slide.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "Jump to slide"
format:
revealjs:
jump-to-slide: false
_quarto:
test:
revealjs:
ensureFileRegexMatches:
- ["jumpToSlide.*false,"]
- ["jumpToSlide.*true,"]
---

## test

`jump-to-slide` is converted to revealjs option and inserted as `jumpToSlide`.

0 comments on commit fcd7abb

Please sign in to comment.