From 6fd1e4cf6a1cc1f807de2101a3d8481a819d1ef5 Mon Sep 17 00:00:00 2001 From: MSzturc Date: Wed, 8 Dec 2021 15:24:01 +0100 Subject: [PATCH] pass reveal options from frontmatter --- src/revealRenderer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/revealRenderer.ts b/src/revealRenderer.ts index 37b433ea..a0147471 100644 --- a/src/revealRenderer.ts +++ b/src/revealRenderer.ts @@ -26,6 +26,7 @@ export class RevealRenderer { async render(input: string) { const { yamlOptions, markdown } = this.parseYamlFrontMatter(input); const options = this.getSlideOptions(yamlOptions); + const revealOptions = this.getRevealOptions(yamlOptions); const { title } = options; const themeUrl = this.getThemeUrl(options.theme); @@ -37,8 +38,8 @@ export class RevealRenderer { slides, themeUrl, highlightThemeUrl, - revealOptionsStr: JSON.stringify({}) - }); + revealOptionsStr: JSON.stringify(revealOptions) + }); console.log(context); @@ -96,6 +97,11 @@ export class RevealRenderer { return _.pick(options, slidifyProps) } + private getRevealOptions(options) { + const revealProps = ['controls', 'controlsTutorial', 'controlsLayout', 'controlsBackArrows', 'progress', 'slideNumber', 'showSlideNumber', 'hashOneBasedIndex', 'hash', 'respondToHashChanges', 'history', 'keyboard', 'keyboardCondition', 'disableLayout', 'overview', 'center', 'touch', 'loop', 'rtl', 'navigationMode', 'shuffle', 'fragments', 'fragmentInURL', 'embedded', 'help', 'pause', 'showNotes', 'autoPlayMedia', 'preloadIframes', 'autoAnimate', 'autoAnimateMatcher', 'autoAnimateEasing', 'autoAnimateDuration', 'autoAnimateUnmatched', 'autoSlide', 'autoSlideStoppable', 'autoSlideMethod', 'defaultTiming', 'mouseWheel', 'previewLinks', 'postMessage', 'postMessageEvents', 'focusBodyOnPageVisibilityChange', 'transition', 'transitionSpeed', 'backgroundTransition', 'pdfMaxPagesPerSlide', 'pdfSeparateFragments', 'pdfPageHeightOffset', 'viewDistance', 'mobileViewDistance', 'display', 'hideInactiveCursor', 'hideCursorTime']; + return _.pick(options, revealProps) + } + private parseYamlFrontMatter(input: string): { yamlOptions: any; markdown: any; } { const document = loadFront(input.replace(/^\uFEFF/, '')); return {