Update to support slide type in publish note and download html style

This commit is contained in:
Wu Cheng-Han 2016-07-30 11:07:47 +08:00
parent 8791447ef9
commit 23c53f3d15
4 changed files with 29 additions and 10 deletions

View file

@ -1 +1 @@
cleancss -o html.min.css github-extract.css markdown.css extra.css site.css
cleancss -o html.min.css github-extract.css markdown.css extra.css slide-preview.css site.css

File diff suppressed because one or more lines are too long

View file

@ -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);

View file

@ -35,6 +35,7 @@
<link rel="stylesheet" href='<%- url %>/css/markdown.css'>
<link rel="stylesheet" href='<%- url %>/vendor/emojify/css/emojify.min.css'>
<link rel="stylesheet" href='<%- url %>/css/extra.css'>
<link rel="stylesheet" href="<%- url %>/css/slide-preview.css">
<link rel="stylesheet" href='<%- url %>/css/site.css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
@ -121,6 +122,7 @@
<script src="<%- url %>/js/common.js" defer></script>
<script src="<%- url %>/js/extra.js" defer></script>
<script src="<%- url %>/js/render.js" defer></script>
<script src="<%- url %>/js/reveal-markdown.js" defer></script>
<script src="<%- url %>/js/pretty.js" defer></script>
<%- include ga %>