summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-07-30 11:07:47 +0800
committerWu Cheng-Han2016-07-30 11:07:47 +0800
commit23c53f3d158294af8fef1cca3086abd7b70f5c68 (patch)
tree43965428ef9722b630ad568134a2500e2422a363 /public/js
parent8791447ef918eb38736a94e8e126c17269f3b683 (diff)
Update to support slide type in publish note and download html style
Diffstat (limited to 'public/js')
-rw-r--r--public/js/pretty.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/public/js/pretty.js b/public/js/pretty.js
index 2d1f27de..adc8c741 100644
--- a/public/js/pretty.js
+++ b/public/js/pretty.js
@@ -3,15 +3,32 @@ var text = $('<textarea/>').html(markdown.html()).text();
var lastMeta = md.meta;
md.meta = {};
var rendered = md.render(text);
-// only render again when meta changed
-if (JSON.stringify(md.meta) != JSON.stringify(lastMeta)) {
- parseMeta(md, null, markdown, $('#toc'), $('#toc-affix'));
- rendered = md.render(text);
+if (md.meta.type && md.meta.type === 'slide') {
+ var slideOptions = {
+ separator: '^(\r\n?|\n)---(\r\n?|\n)$',
+ verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$'
+ };
+ var slides = RevealMarkdown.slidify(text, slideOptions);
+ markdown.html(slides);
+ RevealMarkdown.initialize();
+ // prevent XSS
+ markdown.html(preventXSS(markdown.html()));
+ markdown.addClass('slides');
+} else {
+ if (lastMeta.type && lastMeta.type === 'slide') {
+ refreshView();
+ markdown.removeClass('slides');
+ }
+ // only render again when meta changed
+ if (JSON.stringify(md.meta) != JSON.stringify(lastMeta)) {
+ parseMeta(md, null, markdown, $('#toc'), $('#toc-affix'));
+ rendered = md.render(text);
+ }
+ // prevent XSS
+ rendered = preventXSS(rendered);
+ var result = postProcess(rendered);
+ markdown.html(result.html());
}
-// prevent XSS
-rendered = preventXSS(rendered);
-var result = postProcess(rendered);
-markdown.html(result.html());
$(document.body).show();
finishView(markdown);
autoLinkify(markdown);