summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-09-25 18:12:56 +0800
committerWu Cheng-Han2015-09-25 18:12:56 +0800
commit36451ddbe9264236a818c66c4f72455ed5b44278 (patch)
tree99ad0b7e78c73ac4d8981fc33dffffbb0576a984 /public/js
parent4e358cd6f43b2693e0a6f2cc08cdff16bf0209a5 (diff)
Moving markdown parser function from syncscroll.js to extra.js
Diffstat (limited to 'public/js')
-rw-r--r--public/js/extra.js7
-rw-r--r--public/js/syncscroll.js8
2 files changed, 7 insertions, 8 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 2a43268e..2930ec25 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -429,6 +429,13 @@ var md = new Remarkable('full', {
typographer: true,
highlight: highlightRender
});
+md.renderer.rules.image = function (tokens, idx, options /*, env */ ) {
+ var src = ' src="' + Remarkable.utils.escapeHtml(tokens[idx].src) + '"';
+ var title = tokens[idx].title ? (' title="' + Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(tokens[idx].title)) + '"') : '';
+ var alt = ' alt="' + (tokens[idx].alt ? Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(tokens[idx].alt)) : '') + '"';
+ var suffix = options.xhtmlOut ? ' /' : '';
+ return '<img class="raw"' + src + alt + title + suffix + '>';
+}
md.renderer.rules.list_item_open = function ( /* tokens, idx, options, env */ ) {
return '<li class="raw">';
};
diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js
index 01bc7d78..66d68e64 100644
--- a/public/js/syncscroll.js
+++ b/public/js/syncscroll.js
@@ -78,14 +78,6 @@ md.renderer.rules.heading_open = function (tokens, idx) {
return '<h' + tokens[idx].hLevel + '>';
};
-md.renderer.rules.image = function (tokens, idx, options /*, env */ ) {
- var src = ' src="' + Remarkable.utils.escapeHtml(tokens[idx].src) + '"';
- var title = tokens[idx].title ? (' title="' + Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(tokens[idx].title)) + '"') : '';
- var alt = ' alt="' + (tokens[idx].alt ? Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(tokens[idx].alt)) : '') + '"';
- var suffix = options.xhtmlOut ? ' /' : '';
- return '<img class="raw"' + src + alt + title + suffix + '>';
-}
-
md.renderer.rules.fence = function (tokens, idx, options, env, self) {
var token = tokens[idx];
var langClass = '';