starterlog-theme 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +52 -8
- data/_layouts/slide.html +105 -0
- data/_pages/profile/index.html +1 -1
- data/_pages/start/index.html +7 -2
- data/assets/modules/reveal.js/.gitignore +13 -0
- data/assets/modules/reveal.js/.travis.yml +5 -0
- data/assets/modules/reveal.js/CONTRIBUTING.md +23 -0
- data/assets/modules/reveal.js/Gruntfile.js +187 -0
- data/assets/modules/reveal.js/LICENSE +19 -0
- data/assets/modules/reveal.js/README.md +1185 -0
- data/assets/modules/reveal.js/bower.json +27 -0
- data/assets/modules/reveal.js/css/print/paper.css +203 -0
- data/assets/modules/reveal.js/css/print/pdf.css +171 -0
- data/assets/modules/reveal.js/css/reveal.css +1365 -0
- data/assets/modules/reveal.js/css/reveal.scss +1446 -0
- data/assets/modules/reveal.js/css/theme/README.md +21 -0
- data/assets/modules/reveal.js/css/theme/beige.css +296 -0
- data/assets/modules/reveal.js/css/theme/black.css +292 -0
- data/assets/modules/reveal.js/css/theme/blood.css +315 -0
- data/assets/modules/reveal.js/css/theme/league.css +298 -0
- data/assets/modules/reveal.js/css/theme/moon.css +296 -0
- data/assets/modules/reveal.js/css/theme/night.css +290 -0
- data/assets/modules/reveal.js/css/theme/serif.css +292 -0
- data/assets/modules/reveal.js/css/theme/simple.css +295 -0
- data/assets/modules/reveal.js/css/theme/sky.css +299 -0
- data/assets/modules/reveal.js/css/theme/solarized.css +296 -0
- data/assets/modules/reveal.js/css/theme/source/beige.scss +39 -0
- data/assets/modules/reveal.js/css/theme/source/black.scss +49 -0
- data/assets/modules/reveal.js/css/theme/source/blood.scss +78 -0
- data/assets/modules/reveal.js/css/theme/source/league.scss +34 -0
- data/assets/modules/reveal.js/css/theme/source/moon.scss +57 -0
- data/assets/modules/reveal.js/css/theme/source/night.scss +34 -0
- data/assets/modules/reveal.js/css/theme/source/serif.scss +35 -0
- data/assets/modules/reveal.js/css/theme/source/simple.scss +43 -0
- data/assets/modules/reveal.js/css/theme/source/sky.scss +46 -0
- data/assets/modules/reveal.js/css/theme/source/solarized.scss +63 -0
- data/assets/modules/reveal.js/css/theme/source/white.scss +49 -0
- data/assets/modules/reveal.js/css/theme/template/mixins.scss +29 -0
- data/assets/modules/reveal.js/css/theme/template/settings.scss +43 -0
- data/assets/modules/reveal.js/css/theme/template/theme.scss +352 -0
- data/assets/modules/reveal.js/css/theme/white.css +292 -0
- data/assets/modules/reveal.js/demo.html +410 -0
- data/assets/modules/reveal.js/index.html +50 -0
- data/assets/modules/reveal.js/js/reveal.js +4961 -0
- data/assets/modules/reveal.js/lib/css/zenburn.css +80 -0
- data/assets/modules/reveal.js/lib/font/league-gothic/LICENSE +2 -0
- data/assets/modules/reveal.js/lib/font/league-gothic/league-gothic.css +10 -0
- data/assets/modules/reveal.js/lib/font/league-gothic/league-gothic.eot +0 -0
- data/assets/modules/reveal.js/lib/font/league-gothic/league-gothic.ttf +0 -0
- data/assets/modules/reveal.js/lib/font/league-gothic/league-gothic.woff +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/LICENSE +45 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-italic.ttf +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-regular.ttf +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-semibold.ttf +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff +0 -0
- data/assets/modules/reveal.js/lib/font/source-sans-pro/source-sans-pro.css +39 -0
- data/assets/modules/reveal.js/lib/js/classList.js +2 -0
- data/assets/modules/reveal.js/lib/js/head.min.js +9 -0
- data/assets/modules/reveal.js/lib/js/html5shiv.js +7 -0
- data/assets/modules/reveal.js/package.json +45 -0
- data/assets/modules/reveal.js/plugin/highlight/highlight.js +78 -0
- data/assets/modules/reveal.js/plugin/markdown/example.html +129 -0
- data/assets/modules/reveal.js/plugin/markdown/example.md +31 -0
- data/assets/modules/reveal.js/plugin/markdown/markdown.js +411 -0
- data/assets/modules/reveal.js/plugin/markdown/marked.js +6 -0
- data/assets/modules/reveal.js/plugin/math/math.js +67 -0
- data/assets/modules/reveal.js/plugin/multiplex/client.js +13 -0
- data/assets/modules/reveal.js/plugin/multiplex/index.js +64 -0
- data/assets/modules/reveal.js/plugin/multiplex/master.js +31 -0
- data/assets/modules/reveal.js/plugin/multiplex/package.json +19 -0
- data/assets/modules/reveal.js/plugin/notes-server/client.js +65 -0
- data/assets/modules/reveal.js/plugin/notes-server/index.js +69 -0
- data/assets/modules/reveal.js/plugin/notes-server/notes.html +585 -0
- data/assets/modules/reveal.js/plugin/notes/notes.html +609 -0
- data/assets/modules/reveal.js/plugin/notes/notes.js +145 -0
- data/assets/modules/reveal.js/plugin/print-pdf/print-pdf.js +51 -0
- data/assets/modules/reveal.js/plugin/search/search.js +196 -0
- data/assets/modules/reveal.js/plugin/zoom-js/zoom.js +288 -0
- data/assets/modules/reveal.js/test/examples/assets/image1.png +0 -0
- data/assets/modules/reveal.js/test/examples/assets/image2.png +0 -0
- data/assets/modules/reveal.js/test/examples/barebones.html +41 -0
- data/assets/modules/reveal.js/test/examples/embedded-media.html +49 -0
- data/assets/modules/reveal.js/test/examples/math.html +185 -0
- data/assets/modules/reveal.js/test/examples/slide-backgrounds.html +144 -0
- data/assets/modules/reveal.js/test/examples/slide-transitions.html +101 -0
- data/assets/modules/reveal.js/test/qunit-1.12.0.css +244 -0
- data/assets/modules/reveal.js/test/qunit-1.12.0.js +2212 -0
- data/assets/modules/reveal.js/test/simple.md +12 -0
- data/assets/modules/reveal.js/test/test-markdown-element-attributes.html +134 -0
- data/assets/modules/reveal.js/test/test-markdown-element-attributes.js +46 -0
- data/assets/modules/reveal.js/test/test-markdown-external.html +36 -0
- data/assets/modules/reveal.js/test/test-markdown-external.js +24 -0
- data/assets/modules/reveal.js/test/test-markdown-options.html +41 -0
- data/assets/modules/reveal.js/test/test-markdown-options.js +26 -0
- data/assets/modules/reveal.js/test/test-markdown-slide-attributes.html +128 -0
- data/assets/modules/reveal.js/test/test-markdown-slide-attributes.js +47 -0
- data/assets/modules/reveal.js/test/test-markdown.html +52 -0
- data/assets/modules/reveal.js/test/test-markdown.js +15 -0
- data/assets/modules/reveal.js/test/test-pdf.html +83 -0
- data/assets/modules/reveal.js/test/test-pdf.js +15 -0
- data/assets/modules/reveal.js/test/test.html +86 -0
- data/assets/modules/reveal.js/test/test.js +597 -0
- metadata +117 -10
@@ -0,0 +1,31 @@
|
|
1
|
+
# Markdown Demo
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
## External 1.1
|
6
|
+
|
7
|
+
Content 1.1
|
8
|
+
|
9
|
+
Note: This will only appear in the speaker notes window.
|
10
|
+
|
11
|
+
|
12
|
+
## External 1.2
|
13
|
+
|
14
|
+
Content 1.2
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## External 2
|
19
|
+
|
20
|
+
Content 2.1
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
## External 3.1
|
25
|
+
|
26
|
+
Content 3.1
|
27
|
+
|
28
|
+
|
29
|
+
## External 3.2
|
30
|
+
|
31
|
+
Content 3.2
|
@@ -0,0 +1,411 @@
|
|
1
|
+
/**
|
2
|
+
* The reveal.js markdown plugin. Handles parsing of
|
3
|
+
* markdown inside of presentations as well as loading
|
4
|
+
* of external markdown documents.
|
5
|
+
*/
|
6
|
+
(function( root, factory ) {
|
7
|
+
if (typeof define === 'function' && define.amd) {
|
8
|
+
root.marked = require( './marked' );
|
9
|
+
root.RevealMarkdown = factory( root.marked );
|
10
|
+
root.RevealMarkdown.initialize();
|
11
|
+
} else if( typeof exports === 'object' ) {
|
12
|
+
module.exports = factory( require( './marked' ) );
|
13
|
+
} else {
|
14
|
+
// Browser globals (root is window)
|
15
|
+
root.RevealMarkdown = factory( root.marked );
|
16
|
+
root.RevealMarkdown.initialize();
|
17
|
+
}
|
18
|
+
}( this, function( marked ) {
|
19
|
+
|
20
|
+
var DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$',
|
21
|
+
DEFAULT_NOTES_SEPARATOR = 'note:',
|
22
|
+
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
|
23
|
+
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
|
24
|
+
|
25
|
+
var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';
|
26
|
+
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Retrieves the markdown contents of a slide section
|
30
|
+
* element. Normalizes leading tabs/whitespace.
|
31
|
+
*/
|
32
|
+
function getMarkdownFromSlide( section ) {
|
33
|
+
|
34
|
+
var template = section.querySelector( 'script' );
|
35
|
+
|
36
|
+
// strip leading whitespace so it isn't evaluated as code
|
37
|
+
var text = ( template || section ).textContent;
|
38
|
+
|
39
|
+
// restore script end tags
|
40
|
+
text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '</script>' );
|
41
|
+
|
42
|
+
var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
|
43
|
+
leadingTabs = text.match( /^\n?(\t*)/ )[1].length;
|
44
|
+
|
45
|
+
if( leadingTabs > 0 ) {
|
46
|
+
text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
|
47
|
+
}
|
48
|
+
else if( leadingWs > 1 ) {
|
49
|
+
text = text.replace( new RegExp('\\n? {' + leadingWs + '}', 'g'), '\n' );
|
50
|
+
}
|
51
|
+
|
52
|
+
return text;
|
53
|
+
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Given a markdown slide section element, this will
|
58
|
+
* return all arguments that aren't related to markdown
|
59
|
+
* parsing. Used to forward any other user-defined arguments
|
60
|
+
* to the output markdown slide.
|
61
|
+
*/
|
62
|
+
function getForwardedAttributes( section ) {
|
63
|
+
|
64
|
+
var attributes = section.attributes;
|
65
|
+
var result = [];
|
66
|
+
|
67
|
+
for( var i = 0, len = attributes.length; i < len; i++ ) {
|
68
|
+
var name = attributes[i].name,
|
69
|
+
value = attributes[i].value;
|
70
|
+
|
71
|
+
// disregard attributes that are used for markdown loading/parsing
|
72
|
+
if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
|
73
|
+
|
74
|
+
if( value ) {
|
75
|
+
result.push( name + '="' + value + '"' );
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
result.push( name );
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
return result.join( ' ' );
|
83
|
+
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Inspects the given options and fills out default
|
88
|
+
* values for what's not defined.
|
89
|
+
*/
|
90
|
+
function getSlidifyOptions( options ) {
|
91
|
+
|
92
|
+
options = options || {};
|
93
|
+
options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
|
94
|
+
options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
|
95
|
+
options.attributes = options.attributes || '';
|
96
|
+
|
97
|
+
return options;
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Helper function for constructing a markdown slide.
|
103
|
+
*/
|
104
|
+
function createMarkdownSlide( content, options ) {
|
105
|
+
|
106
|
+
options = getSlidifyOptions( options );
|
107
|
+
|
108
|
+
var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
|
109
|
+
|
110
|
+
if( notesMatch.length === 2 ) {
|
111
|
+
content = notesMatch[0] + '<aside class="notes">' + marked(notesMatch[1].trim()) + '</aside>';
|
112
|
+
}
|
113
|
+
|
114
|
+
// prevent script end tags in the content from interfering
|
115
|
+
// with parsing
|
116
|
+
content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER );
|
117
|
+
|
118
|
+
return '<script type="text/template">' + content + '</script>';
|
119
|
+
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Parses a data string into multiple slides based
|
124
|
+
* on the passed in separator arguments.
|
125
|
+
*/
|
126
|
+
function slidify( markdown, options ) {
|
127
|
+
|
128
|
+
options = getSlidifyOptions( options );
|
129
|
+
|
130
|
+
var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
|
131
|
+
horizontalSeparatorRegex = new RegExp( options.separator );
|
132
|
+
|
133
|
+
var matches,
|
134
|
+
lastIndex = 0,
|
135
|
+
isHorizontal,
|
136
|
+
wasHorizontal = true,
|
137
|
+
content,
|
138
|
+
sectionStack = [];
|
139
|
+
|
140
|
+
// iterate until all blocks between separators are stacked up
|
141
|
+
while( matches = separatorRegex.exec( markdown ) ) {
|
142
|
+
notes = null;
|
143
|
+
|
144
|
+
// determine direction (horizontal by default)
|
145
|
+
isHorizontal = horizontalSeparatorRegex.test( matches[0] );
|
146
|
+
|
147
|
+
if( !isHorizontal && wasHorizontal ) {
|
148
|
+
// create vertical stack
|
149
|
+
sectionStack.push( [] );
|
150
|
+
}
|
151
|
+
|
152
|
+
// pluck slide content from markdown input
|
153
|
+
content = markdown.substring( lastIndex, matches.index );
|
154
|
+
|
155
|
+
if( isHorizontal && wasHorizontal ) {
|
156
|
+
// add to horizontal stack
|
157
|
+
sectionStack.push( content );
|
158
|
+
}
|
159
|
+
else {
|
160
|
+
// add to vertical stack
|
161
|
+
sectionStack[sectionStack.length-1].push( content );
|
162
|
+
}
|
163
|
+
|
164
|
+
lastIndex = separatorRegex.lastIndex;
|
165
|
+
wasHorizontal = isHorizontal;
|
166
|
+
}
|
167
|
+
|
168
|
+
// add the remaining slide
|
169
|
+
( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
|
170
|
+
|
171
|
+
var markdownSections = '';
|
172
|
+
|
173
|
+
// flatten the hierarchical stack, and insert <section data-markdown> tags
|
174
|
+
for( var i = 0, len = sectionStack.length; i < len; i++ ) {
|
175
|
+
// vertical
|
176
|
+
if( sectionStack[i] instanceof Array ) {
|
177
|
+
markdownSections += '<section '+ options.attributes +'>';
|
178
|
+
|
179
|
+
sectionStack[i].forEach( function( child ) {
|
180
|
+
markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
|
181
|
+
} );
|
182
|
+
|
183
|
+
markdownSections += '</section>';
|
184
|
+
}
|
185
|
+
else {
|
186
|
+
markdownSections += '<section '+ options.attributes +' data-markdown>' + createMarkdownSlide( sectionStack[i], options ) + '</section>';
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
return markdownSections;
|
191
|
+
|
192
|
+
}
|
193
|
+
|
194
|
+
/**
|
195
|
+
* Parses any current data-markdown slides, splits
|
196
|
+
* multi-slide markdown into separate sections and
|
197
|
+
* handles loading of external markdown.
|
198
|
+
*/
|
199
|
+
function processSlides() {
|
200
|
+
|
201
|
+
var sections = document.querySelectorAll( '[data-markdown]'),
|
202
|
+
section;
|
203
|
+
|
204
|
+
for( var i = 0, len = sections.length; i < len; i++ ) {
|
205
|
+
|
206
|
+
section = sections[i];
|
207
|
+
|
208
|
+
if( section.getAttribute( 'data-markdown' ).length ) {
|
209
|
+
|
210
|
+
var xhr = new XMLHttpRequest(),
|
211
|
+
url = section.getAttribute( 'data-markdown' );
|
212
|
+
|
213
|
+
datacharset = section.getAttribute( 'data-charset' );
|
214
|
+
|
215
|
+
// see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
|
216
|
+
if( datacharset != null && datacharset != '' ) {
|
217
|
+
xhr.overrideMimeType( 'text/html; charset=' + datacharset );
|
218
|
+
}
|
219
|
+
|
220
|
+
xhr.onreadystatechange = function() {
|
221
|
+
if( xhr.readyState === 4 ) {
|
222
|
+
// file protocol yields status code 0 (useful for local debug, mobile applications etc.)
|
223
|
+
if ( ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status === 0 ) {
|
224
|
+
|
225
|
+
section.outerHTML = slidify( xhr.responseText, {
|
226
|
+
separator: section.getAttribute( 'data-separator' ),
|
227
|
+
verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
|
228
|
+
notesSeparator: section.getAttribute( 'data-separator-notes' ),
|
229
|
+
attributes: getForwardedAttributes( section )
|
230
|
+
});
|
231
|
+
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
|
235
|
+
section.outerHTML = '<section data-state="alert">' +
|
236
|
+
'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
|
237
|
+
'Check your browser\'s JavaScript console for more details.' +
|
238
|
+
'<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
|
239
|
+
'</section>';
|
240
|
+
|
241
|
+
}
|
242
|
+
}
|
243
|
+
};
|
244
|
+
|
245
|
+
xhr.open( 'GET', url, false );
|
246
|
+
|
247
|
+
try {
|
248
|
+
xhr.send();
|
249
|
+
}
|
250
|
+
catch ( e ) {
|
251
|
+
alert( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e );
|
252
|
+
}
|
253
|
+
|
254
|
+
}
|
255
|
+
else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-separator-vertical' ) || section.getAttribute( 'data-separator-notes' ) ) {
|
256
|
+
|
257
|
+
section.outerHTML = slidify( getMarkdownFromSlide( section ), {
|
258
|
+
separator: section.getAttribute( 'data-separator' ),
|
259
|
+
verticalSeparator: section.getAttribute( 'data-separator-vertical' ),
|
260
|
+
notesSeparator: section.getAttribute( 'data-separator-notes' ),
|
261
|
+
attributes: getForwardedAttributes( section )
|
262
|
+
});
|
263
|
+
|
264
|
+
}
|
265
|
+
else {
|
266
|
+
section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
}
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Check if a node value has the attributes pattern.
|
274
|
+
* If yes, extract it and add that value as one or several attributes
|
275
|
+
* the the terget element.
|
276
|
+
*
|
277
|
+
* You need Cache Killer on Chrome to see the effect on any FOM transformation
|
278
|
+
* directly on refresh (F5)
|
279
|
+
* http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#answer-11786277
|
280
|
+
*/
|
281
|
+
function addAttributeInElement( node, elementTarget, separator ) {
|
282
|
+
|
283
|
+
var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
|
284
|
+
var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' );
|
285
|
+
var nodeValue = node.nodeValue;
|
286
|
+
if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
|
287
|
+
|
288
|
+
var classes = matches[1];
|
289
|
+
nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
|
290
|
+
node.nodeValue = nodeValue;
|
291
|
+
while( matchesClass = mardownClassRegex.exec( classes ) ) {
|
292
|
+
elementTarget.setAttribute( matchesClass[1], matchesClass[2] );
|
293
|
+
}
|
294
|
+
return true;
|
295
|
+
}
|
296
|
+
return false;
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Add attributes to the parent element of a text node,
|
301
|
+
* or the element of an attribute node.
|
302
|
+
*/
|
303
|
+
function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
|
304
|
+
|
305
|
+
if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
|
306
|
+
previousParentElement = element;
|
307
|
+
for( var i = 0; i < element.childNodes.length; i++ ) {
|
308
|
+
childElement = element.childNodes[i];
|
309
|
+
if ( i > 0 ) {
|
310
|
+
j = i - 1;
|
311
|
+
while ( j >= 0 ) {
|
312
|
+
aPreviousChildElement = element.childNodes[j];
|
313
|
+
if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
|
314
|
+
previousParentElement = aPreviousChildElement;
|
315
|
+
break;
|
316
|
+
}
|
317
|
+
j = j - 1;
|
318
|
+
}
|
319
|
+
}
|
320
|
+
parentSection = section;
|
321
|
+
if( childElement.nodeName == "section" ) {
|
322
|
+
parentSection = childElement ;
|
323
|
+
previousParentElement = childElement ;
|
324
|
+
}
|
325
|
+
if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
|
326
|
+
addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
if ( element.nodeType == Node.COMMENT_NODE ) {
|
332
|
+
if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
|
333
|
+
addAttributeInElement( element, section, separatorSectionAttributes );
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Converts any current data-markdown slides in the
|
340
|
+
* DOM to HTML.
|
341
|
+
*/
|
342
|
+
function convertSlides() {
|
343
|
+
|
344
|
+
var sections = document.querySelectorAll( '[data-markdown]');
|
345
|
+
|
346
|
+
for( var i = 0, len = sections.length; i < len; i++ ) {
|
347
|
+
|
348
|
+
var section = sections[i];
|
349
|
+
|
350
|
+
// Only parse the same slide once
|
351
|
+
if( !section.getAttribute( 'data-markdown-parsed' ) ) {
|
352
|
+
|
353
|
+
section.setAttribute( 'data-markdown-parsed', true )
|
354
|
+
|
355
|
+
var notes = section.querySelector( 'aside.notes' );
|
356
|
+
var markdown = getMarkdownFromSlide( section );
|
357
|
+
|
358
|
+
section.innerHTML = marked( markdown );
|
359
|
+
addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
|
360
|
+
section.parentNode.getAttribute( 'data-element-attributes' ) ||
|
361
|
+
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
|
362
|
+
section.getAttribute( 'data-attributes' ) ||
|
363
|
+
section.parentNode.getAttribute( 'data-attributes' ) ||
|
364
|
+
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
|
365
|
+
|
366
|
+
// If there were notes, we need to re-add them after
|
367
|
+
// having overwritten the section's HTML
|
368
|
+
if( notes ) {
|
369
|
+
section.appendChild( notes );
|
370
|
+
}
|
371
|
+
|
372
|
+
}
|
373
|
+
|
374
|
+
}
|
375
|
+
|
376
|
+
}
|
377
|
+
|
378
|
+
// API
|
379
|
+
return {
|
380
|
+
|
381
|
+
initialize: function() {
|
382
|
+
if( typeof marked === 'undefined' ) {
|
383
|
+
throw 'The reveal.js Markdown plugin requires marked to be loaded';
|
384
|
+
}
|
385
|
+
|
386
|
+
if( typeof hljs !== 'undefined' ) {
|
387
|
+
marked.setOptions({
|
388
|
+
highlight: function( code, lang ) {
|
389
|
+
return hljs.highlightAuto( code, [lang] ).value;
|
390
|
+
}
|
391
|
+
});
|
392
|
+
}
|
393
|
+
|
394
|
+
var options = Reveal.getConfig().markdown;
|
395
|
+
|
396
|
+
if ( options ) {
|
397
|
+
marked.setOptions( options );
|
398
|
+
}
|
399
|
+
|
400
|
+
processSlides();
|
401
|
+
convertSlides();
|
402
|
+
},
|
403
|
+
|
404
|
+
// TODO: Do these belong in the API?
|
405
|
+
processSlides: processSlides,
|
406
|
+
convertSlides: convertSlides,
|
407
|
+
slidify: slidify
|
408
|
+
|
409
|
+
};
|
410
|
+
|
411
|
+
}));
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* marked - a markdown parser
|
3
|
+
* Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
|
4
|
+
* https://github.com/chjj/marked
|
5
|
+
*/
|
6
|
+
(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]||""});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]="right"}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]="center"}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]="left"}else{item.align[i]=null}}for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].split(/ *\| */)}this.tokens.push(item);continue}if(cap=this.rules.lheading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[2]==="="?1:2,text:cap[1]});continue}if(cap=this.rules.hr.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"hr"});continue}if(cap=this.rules.blockquote.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"blockquote_start"});cap=cap[0].replace(/^ *> ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i<l;i++){item=cap[i];space=item.length;item=item.replace(/^ *([*+-]|\d+\.) +/,"");if(~item.indexOf("\n ")){space-=item.length;item=!this.options.pedantic?item.replace(new RegExp("^ {1,"+space+"}","gm"),""):item.replace(/^ {1,4}/gm,"")}if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(cap[i+1])[0];if(bull!==b&&!(bull.length>1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&(cap[1]==="pre"||cap[1]==="script"||cap[1]==="style"),text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]="right"}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]="center"}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]="left"}else{item.align[i]=null}}for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */)}this.tokens.push(item);continue}if(top&&(cap=this.rules.paragraph.exec(src))){src=src.substring(cap[0].length);this.tokens.push({type:"paragraph",text:cap[1].charAt(cap[1].length-1)==="\n"?cap[1].slice(0,-1):cap[1]});continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"text",text:cap[0]});continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return this.tokens};var inline={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};inline._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;inline._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^<a /i.test(cap[0])){this.inLink=true}else if(this.inLink&&/^<\/a>/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.text(escape(this.smartypants(cap[0])));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;var out="",l=text.length,i=0,ch;for(;i<l;i++){ch=text.charCodeAt(i);if(Math.random()>.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"<pre><code>"+(escaped?code:escape(code,true))+"\n</code></pre>"}return'<pre><code class="'+this.options.langPrefix+escape(lang,true)+'">'+(escaped?code:escape(code,true))+"\n</code></pre>\n"};Renderer.prototype.blockquote=function(quote){return"<blockquote>\n"+quote+"</blockquote>\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"<h"+level+' id="'+this.options.headerPrefix+raw.toLowerCase().replace(/[^\w]+/g,"-")+'">'+text+"</h"+level+">\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"</"+type+">\n"};Renderer.prototype.listitem=function(text){return"<li>"+text+"</li>\n"};Renderer.prototype.paragraph=function(text){return"<p>"+text+"</p>\n"};Renderer.prototype.table=function(header,body){return"<table>\n"+"<thead>\n"+header+"</thead>\n"+"<tbody>\n"+body+"</tbody>\n"+"</table>\n"};Renderer.prototype.tablerow=function(content){return"<tr>\n"+content+"</tr>\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"</"+type+">\n"};Renderer.prototype.strong=function(text){return"<strong>"+text+"</strong>"};Renderer.prototype.em=function(text){return"<em>"+text+"</em>"};Renderer.prototype.codespan=function(text){return"<code>"+text+"</code>"};Renderer.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"};Renderer.prototype.del=function(text){return"<del>"+text+"</del>"};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='<a href="'+href+'"';if(title){out+=' title="'+title+'"'}out+=">"+text+"</a>";return out};Renderer.prototype.image=function(href,title,text){var out='<img src="'+href+'" alt="'+text+'"';if(title){out+=' title="'+title+'"'}out+=this.options.xhtml?"/>":">";return out};Renderer.prototype.text=function(text){return text};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i<this.token.header.length;i++){flags={header:true,align:this.token.align[i]};cell+=this.renderer.tablecell(this.inline.output(this.token.header[i]),{header:true,align:this.token.align[i]})}header+=this.renderer.tablerow(cell);for(i=0;i<this.token.cells.length;i++){row=this.token.cells[i];cell="";for(j=0;j<row.length;j++){cell+=this.renderer.tablecell(this.inline.output(row[j]),{header:false,align:this.token.align[j]})}body+=this.renderer.tablerow(cell)}return this.renderer.table(header,body)}case"blockquote_start":{var body="";while(this.next().type!=="blockquote_end"){body+=this.tok()}return this.renderer.blockquote(body)}case"list_start":{var body="",ordered=this.token.ordered;while(this.next().type!=="list_end"){body+=this.tok()}return this.renderer.list(body,ordered)}case"list_item_start":{var body="";while(this.next().type!=="list_item_end"){body+=this.token.type==="text"?this.parseText():this.tok()}return this.renderer.listitem(body)}case"loose_item_start":{var body="";while(this.next().type!=="list_item_end"){body+=this.tok()}return this.renderer.listitem(body)}case"html":{var html=!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;return this.renderer.html(html)}case"paragraph":{return this.renderer.paragraph(this.inline.output(this.token.text))}case"text":{return this.renderer.paragraph(this.parseText())}}};function escape(html,encode){return html.replace(!encode?/&(?!#?\w+;)/g:/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;i<arguments.length;i++){target=arguments[i];for(key in target){if(Object.prototype.hasOwnProperty.call(target,key)){obj[key]=target[key]}}}return obj}function marked(src,opt,callback){if(callback||typeof opt==="function"){if(!callback){callback=opt;opt=null}opt=merge({},marked.defaults,opt||{});var highlight=opt.highlight,tokens,pending,i=0;try{tokens=Lexer.lex(src,opt)}catch(e){return callback(e)}pending=tokens.length;var done=function(err){if(err){opt.highlight=highlight;return callback(err)}var out;try{out=Parser.parse(tokens,opt)}catch(e){err=e}opt.highlight=highlight;return err?callback(err):callback(null,out)};if(!highlight||highlight.length<3){return done()}delete opt.highlight;if(!pending)return done();for(;i<tokens.length;i++){(function(token){if(token.type!=="code"){return--pending||done()}return highlight(token.text,token.lang,function(err,code){if(err)return done(err);if(code==null||code===token.text){return--pending||done()}token.text=code;token.escaped=true;--pending||done()})})(tokens[i])}return}try{if(opt)opt=merge({},marked.defaults,opt);return Parser.parse(Lexer.lex(src,opt),opt)}catch(e){e.message+="\nPlease report this to https://github.com/chjj/marked.";if((opt||marked.defaults).silent){return"<p>An error occured:</p><pre>"+escape(e.message+"",true)+"</pre>"}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,sanitizer:null,mangle:true,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/**
|
2
|
+
* A plugin which enables rendering of math equations inside
|
3
|
+
* of reveal.js slides. Essentially a thin wrapper for MathJax.
|
4
|
+
*
|
5
|
+
* @author Hakim El Hattab
|
6
|
+
*/
|
7
|
+
var RevealMath = window.RevealMath || (function(){
|
8
|
+
|
9
|
+
var options = Reveal.getConfig().math || {};
|
10
|
+
options.mathjax = options.mathjax || 'https://cdn.mathjax.org/mathjax/latest/MathJax.js';
|
11
|
+
options.config = options.config || 'TeX-AMS_HTML-full';
|
12
|
+
|
13
|
+
loadScript( options.mathjax + '?config=' + options.config, function() {
|
14
|
+
|
15
|
+
MathJax.Hub.Config({
|
16
|
+
messageStyle: 'none',
|
17
|
+
tex2jax: {
|
18
|
+
inlineMath: [['$','$'],['\\(','\\)']] ,
|
19
|
+
skipTags: ['script','noscript','style','textarea','pre']
|
20
|
+
},
|
21
|
+
skipStartupTypeset: true
|
22
|
+
});
|
23
|
+
|
24
|
+
// Typeset followed by an immediate reveal.js layout since
|
25
|
+
// the typesetting process could affect slide height
|
26
|
+
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
|
27
|
+
MathJax.Hub.Queue( Reveal.layout );
|
28
|
+
|
29
|
+
// Reprocess equations in slides when they turn visible
|
30
|
+
Reveal.addEventListener( 'slidechanged', function( event ) {
|
31
|
+
|
32
|
+
MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
|
33
|
+
|
34
|
+
} );
|
35
|
+
|
36
|
+
} );
|
37
|
+
|
38
|
+
function loadScript( url, callback ) {
|
39
|
+
|
40
|
+
var head = document.querySelector( 'head' );
|
41
|
+
var script = document.createElement( 'script' );
|
42
|
+
script.type = 'text/javascript';
|
43
|
+
script.src = url;
|
44
|
+
|
45
|
+
// Wrapper for callback to make sure it only fires once
|
46
|
+
var finish = function() {
|
47
|
+
if( typeof callback === 'function' ) {
|
48
|
+
callback.call();
|
49
|
+
callback = null;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
script.onload = finish;
|
54
|
+
|
55
|
+
// IE
|
56
|
+
script.onreadystatechange = function() {
|
57
|
+
if ( this.readyState === 'loaded' ) {
|
58
|
+
finish();
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
// Normal browsers
|
63
|
+
head.appendChild( script );
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
})();
|