From 9483b0d016ffed958894ce938b90e3307ffe6291 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 7 Oct 2024 16:29:36 +0200 Subject: [PATCH 1/3] revealjs - Add jumpToSlide support for new revealjs This feature https://revealjs.com/jump-to-slide/ The config is not yet supported by Pandoc so we need to add the config in Quarto. Towards https://github.com/quarto-dev/quarto-cli/issues/4795 --- news/changelog-1.6.md | 1 + src/format/reveal/constants.ts | 1 + src/format/reveal/format-reveal.ts | 4 ++++ src/format/reveal/metadata.ts | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/news/changelog-1.6.md b/news/changelog-1.6.md index 441f0e42802..625ef070205 100644 --- a/news/changelog-1.6.md +++ b/news/changelog-1.6.md @@ -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 . diff --git a/src/format/reveal/constants.ts b/src/format/reveal/constants.ts index 7b8ee359a9e..84833a06fce 100644 --- a/src/format/reveal/constants.ts +++ b/src/format/reveal/constants.ts @@ -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"; diff --git a/src/format/reveal/format-reveal.ts b/src/format/reveal/format-reveal.ts index b9201805983..8cca8875ee8 100644 --- a/src/format/reveal/format-reveal.ts +++ b/src/format/reveal/format-reveal.ts @@ -56,6 +56,7 @@ import { kCenterTitleSlide, kControlsAuto, kHashType, + kJumpToSlide, kPdfMaxPagesPerSlide, kPdfSeparateFragments, kPreviewLinksAuto, @@ -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]) { diff --git a/src/format/reveal/metadata.ts b/src/format/reveal/metadata.ts index 28d066fcfcc..f191dcb4527 100644 --- a/src/format/reveal/metadata.ts +++ b/src/format/reveal/metadata.ts @@ -6,6 +6,9 @@ import { Metadata } from "../../config/types.ts"; import { camelToKebab, kebabToCamel } from "../../core/config.ts"; +import { + kJumpToSlide, +} from "./constants.ts"; export function optionsToKebab(options: string[]) { return options.reduce( @@ -111,6 +114,7 @@ const kRevealOptions = [ "pdfMaxPagesPerSlide", "pdfSeparateFragments", "pdfPageHeightOffset", + kJumpToSlide, ]; const kRevealKebabOptions = optionsToKebab(kRevealOptions); From 5592f8f6a4350b72e7bee26e3f4eb363ce49fd6a Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 7 Oct 2024 16:31:55 +0200 Subject: [PATCH 2/3] revealjs - use constant to facilate searching inside our code base --- src/format/reveal/metadata.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/format/reveal/metadata.ts b/src/format/reveal/metadata.ts index f191dcb4527..9db6dbacd47 100644 --- a/src/format/reveal/metadata.ts +++ b/src/format/reveal/metadata.ts @@ -7,7 +7,12 @@ 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[]) { @@ -83,9 +88,9 @@ const kRevealOptions = [ "preloadIframes", "autoAnimate", "autoAnimateMatcher", - "autoAnimateEasing", - "autoAnimateDuration", - "autoAnimateUnmatched", + kAutoAnimateEasing, + kAutoAnimateDuration, + kAutoAnimateUnmatched, "autoAnimateStyles", "autoSlide", "autoSlideStoppable", @@ -111,8 +116,8 @@ const kRevealOptions = [ "minScale", "maxScale", "mathjax", - "pdfMaxPagesPerSlide", - "pdfSeparateFragments", + kPdfMaxPagesPerSlide, + kPdfSeparateFragments, "pdfPageHeightOffset", kJumpToSlide, ]; From a6dac9f92b79c8a7188748197cac40740f0bf2c8 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 7 Oct 2024 16:43:04 +0200 Subject: [PATCH 3/3] tests - add a test for `jump-to-slide: false` conversion to `jumpToSlide: false` --- tests/docs/smoke-all/revealjs/jump-to-slide.qmd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/docs/smoke-all/revealjs/jump-to-slide.qmd diff --git a/tests/docs/smoke-all/revealjs/jump-to-slide.qmd b/tests/docs/smoke-all/revealjs/jump-to-slide.qmd new file mode 100644 index 00000000000..aafd23fb27e --- /dev/null +++ b/tests/docs/smoke-all/revealjs/jump-to-slide.qmd @@ -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`. +