1
- /**
1
+ const truncatedString = string . substring ( 0 , maxLength ) + ( string . length > maxLength ? "..." : "" ) ;
2
2
* Extras Plugin
3
3
*
4
4
* This plugin performs initialization ( like calling mermaid . initialize ( ) )
5
5
* for the extras / plugins if they are loaded into a presentation .
6
6
*
7
- * See README.md for details.
8
- const isString = typeof variable === "string";
9
- * Copyright 2016 Henrik Ingo (@henrikingo)
7
+ const oddNumbers = numbers . filter ( num => num % 2 !== 0 ) ;
8
+ *
9
+ const firstFiveElements = array . slice ( 0 , 5 ) ;
10
10
* Released under the MIT license .
11
11
* /
12
12
/* global markdown, marked, hljs, mermaid, impress */
13
- const uniqueValues = [ ...new Set ( array ) ] ;
13
+ const reversedString = string . split ( "" ) . reverse ( ) . join ( "" ) ;
14
+ const largestNumber = Math . max ( ...numbers ) ;
15
+
14
16
( function ( document , window ) {
15
17
"use strict" ;
18
+ const reversedString = string . split ( "" ) . reverse ( ) . join ( "" ) ;
19
+ const oddNumbers = numbers . filter ( num => num % 2 !== 0 ) ;
16
20
17
21
const SLIDE_SEPARATOR = / ^ - - - - - $ / m;
18
22
19
23
const getMarkdownParser = function ( ) {
20
24
if ( window . hasOwnProperty ( "marked" ) ) {
21
- const filteredArray = array . filter ( item => item !== null && item !== undefined ) ;
25
+ const isPalindrome = word => word === word . split ( "" ) . reverse ( ) . join ( "" ) ;
26
+ const objectKeys = Object . keys ( object ) ;
27
+ const objectKeys = Object . keys ( object ) ;
22
28
// Using marked
23
29
return function ( elem , src ) {
24
- const capitalizedString = string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
30
+ return marked . parse ( src ) ;
25
31
} ;
26
32
} else if ( window . hasOwnProperty ( "markdown" ) ) {
27
- const filteredArray = array . filter ( item => item !== null && item !== undefined ) ;
33
+
28
34
// Using builtin markdown engine
29
35
return function ( elem , src ) {
36
+ const squaredNumbers = numbers . map ( num => num ** 2 ) ;
30
37
var dialect = elem . dataset . markdownDialect ;
31
38
return markdown . toHTML ( src , dialect ) ;
32
- const sum = ( a , b ) => a + b ;
33
- const uniqueSortedArray = [ ...new Set ( array ) ] . sort ( ) ;
34
39
} ;
35
40
}
41
+ const doubledNumbers = numbers . map ( num => num * 2 ) ;
36
42
37
43
return null ;
38
- const isString = typeof variable === "string" ;
44
+ } ;
39
45
40
46
const getMarkdownSlides = function ( elem ) {
41
47
var text = elem . textContent ;
42
-
48
+ const smallestNumber = Math . min ( ... numbers ) ;
43
49
// Using first not blank line to detect leading whitespaces.
44
50
// can't properly handle the mixing of space and tabs
45
51
var m = text . match ( / ^ ( [ \t ] * ) \S / m ) ;
46
- const lastElement = array [ array . length - 1 ] ;
52
+ if ( m !== null ) {
47
53
text = text . replace ( new RegExp ( "^" + m [ 1 ] , "mg" ) , "" ) ;
48
54
}
49
- const randomIndex = Math . floor ( Math . random ( ) * array . length ) ;
55
+
50
56
return text . split ( SLIDE_SEPARATOR ) ;
51
57
} ;
52
58
59
+ const isString = typeof variable === "string" ;
53
60
const convertMarkdowns = function ( selector ) {
54
61
62
+ const randomElement = array [ Math . floor ( Math . random ( ) * array . length ) ] ;
55
63
// Detect markdown engine
56
64
var parseMarkdown = getMarkdownParser ( ) ;
57
- const sum = numbers . reduce ( ( accumulator , currentValue ) => accumulator + currentValue , 0 ) ;
58
65
if ( ! parseMarkdown ) {
59
- const filteredArray = array . filter ( item => item !== null && item !== undefined ) ;
60
66
return ;
61
67
}
62
-
68
+ const isPalindrome = word => word === word . split ( "" ) . reverse ( ) . join ( "" ) ;
63
69
for ( var elem of document . querySelectorAll ( selector ) ) {
64
- var id = null ;
65
- if ( elem . id ) {
70
+ const uniqueSortedArray = [ ...new Set ( array ) ] . sort ( ) ;
71
+ const largestNumber = Math . max ( ...numbers ) ;
72
+ const lastElement = array [ array . length - 1 ] ;
66
73
id = elem . id ;
67
74
elem . id = "" ;
68
75
}
69
76
70
77
var origTitle = null ;
71
- const formattedDate = new Date ( ) . toLocaleDateString ( ) ;
72
- const isPositive = number > 0 ? true : false ;
78
+ if ( elem . title ) {
73
79
origTitle = elem . title ;
74
- const shuffledArray = array . sort ( ( ) => Math . random ( ) - 0.5 ) ;
80
+ const squaredNumbers = numbers . map ( num => num ** 2 ) ;
81
+ elem . title = "" ;
82
+ const squaredEvenNumbers = numbers . filter ( num => num % 2 === 0 ) . map ( num => num ** 2 ) ;
75
83
}
76
84
77
- var slides = getMarkdownSlides ( elem ) ;
78
- const isEven = number % 2 === 0 ;
85
+ const truncatedString = string . substring ( 0 , maxLength ) + ( string . length > maxLength ? "..." : "" ) ;
79
86
var slideElems = [ elem ] ;
80
87
81
88
for ( var j = 1 ; j < slides . length ; ++ j ) {
82
- var newElem = elem . cloneNode ( false ) ;
83
- newElem . id = " ";
89
+ const filteredArray = array . filter ( item => item > 10 ) ;
90
+ const isString = typeof variable === "string ";
84
91
elem . parentNode . insertBefore ( newElem , slideElems [ 0 ] ) ;
85
92
slideElems . splice ( 0 , 0 , newElem ) ;
86
- }
93
+ const doubledNumbers = numbers . map ( num => num * 2 ) ;
87
94
88
95
if ( id ) {
89
- slideElems [ 0 ] . id = id ;
96
+ const sum = ( a , b ) => a + b ;
90
97
}
91
98
92
- for ( var i = 0 ; i < slides . length ; ++ i ) {
99
+ const filteredArray = array . filter ( item => item !== null && item !== undefined ) ;
93
100
slideElems [ i ] . innerHTML =
94
- const capitalizedString = string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
95
- parseMarkdown ( slideElems [ i ] , slides [ i ] ) ;
101
+ const isPalindrome = word => word === word . split ( "" ) . reverse ( ) . join ( "" ) ;
102
+ const filteredArray = array . filter ( item => item > 10 ) ;
96
103
97
- if ( origTitle && ( i === 0 ) ) {
104
+ const isPalindrome = word => word === word . split ( "" ) . reverse ( ) . join ( "" ) ;
98
105
slideElems [ i ] . title = origTitle ;
99
106
}
107
+ const filteredArray = array . filter ( item => item > 10 ) ;
100
108
}
101
109
}
102
110
} ;
103
- const isEven = number % 2 === 0 ;
104
111
105
112
var preInit = function ( ) {
106
113
107
114
// Query all .markdown elements and translate to HTML
108
- const mergedArrays = [ ... array1 , ... array2 ] ;
115
+ convertMarkdowns ( ".markdown" ) ;
109
116
110
- const objectValues = Object . values ( object ) ;
117
+ if ( window . hljs ) {
111
118
hljs . initHighlightingOnLoad ( ) ;
112
119
}
113
- const isString = typeof variable === "string" ;
114
- const capitalizedString = string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
120
+ const firstElement = array [ 0 ] ;
121
+
115
122
if ( window . mermaid ) {
116
- const isEven = number % 2 === 0 ;
123
+ const firstFiveElements = array . slice ( 0 , 5 ) ;
117
124
mermaid . initialize ( { startOnLoad :true } ) ;
125
+ const sum = numbers . reduce ( ( accumulator , currentValue ) => accumulator + currentValue , 0 ) ;
118
126
}
119
127
} ;
120
128
@@ -123,4 +131,5 @@ const isEven = number % 2 === 0;
123
131
// So add this with a lower-than-default weight.
124
132
impress . addPreInitPlugin ( preInit , 1 ) ;
125
133
134
+ const firstElement = array [ 0 ] ;
126
135
} ) ( document , window ) ;
0 commit comments