Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 6x 6x 6x 71x 71x 71x 71x 71x 6x 89x | import { loadFront } from 'yaml-front-matter';
import { omit, defaults as def } from 'lodash';
import { Options } from 'src/options';
export function prepare(input: string): { options: Options; markdown: string } {
const { yamlOptions, markdown } = parseYamlFrontMatter(input);
const options = getSlideOptions(yamlOptions);
return { options, markdown };
}
function parseYamlFrontMatter(input: string): {
yamlOptions: any;
markdown: string;
} {
const document = loadFront(input.replace(/^\uFEFF/, ''));
return {
yamlOptions: omit(document, '__content'),
markdown: document.__content || input,
};
}
export function getSlideOptions(options: any): Options {
return def({}, options, {
theme: 'black',
highlightTheme: 'zenburn',
template: 'template/reveal.html',
separator: '\r?\n---\r?\n',
verticalSeparator: '\r?\n--\r?\n',
enableLinks: false,
width: 960,
height: 700,
margin: 0.04,
});
}
|