Skip to content

Commit

Permalink
pass reveal options from frontmatter
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzturc committed Dec 8, 2021
1 parent 41efd16 commit 6fd1e4c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/revealRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -37,8 +38,8 @@ export class RevealRenderer {
slides,
themeUrl,
highlightThemeUrl,
revealOptionsStr: JSON.stringify({})
});
revealOptionsStr: JSON.stringify(revealOptions)
});

console.log(context);

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6fd1e4c

Please sign in to comment.