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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 5x 5x 71x 71x 71x 71x 1x 1x 3x 3x 3x 3x 3x 71x 3x 2x 2x 2x 1x 2x 1x | import { CommentParser } from 'src/comment'; import { Options } from 'src/options'; export class DefaultBackgroundProcessor { private slideCommentRegex = /<!--\s*(?:\.)?slide.*-->/; private parser = new CommentParser(); process(markdown: string, options: Options) { let output = markdown; if (options?.bg) { Iif (options?.bg == 'transparent' || options?.bg == 'rgba(0,0,0,0)') { output = `<style> body { background-color: rgba(0,0,0,0) !important; } </style> ` + output; } markdown .split(new RegExp(options.separator, 'gmi')) .map(slidegroup => { return slidegroup .split(new RegExp(options.verticalSeparator, 'gmi')) .map(slide => { if (slide) { const newSlide = this.transformSlide(slide, options?.bg); output = output.split(slide).join(newSlide); return newSlide; } else E{ return slide; } }) .join(options.verticalSeparator); }) .join(options.separator); } return output; } transformSlide(slide: string, bg: string) { if (this.slideCommentRegex.test(slide)) { const [match] = this.slideCommentRegex.exec(slide); const comment = this.parser.parseLine(match); if (!comment.hasAttribute('data-background-image') && !comment.hasAttribute('data-background-color')) { comment.addAttribute('bg', bg); } return slide.replace(this.slideCommentRegex, this.parser.commentToString(comment)); } else { return slide + `\n<!-- slide bg="${bg}" -->\n`; } } } |