Moving markdown parser function from syncscroll.js to extra.js

This commit is contained in:
Wu Cheng-Han 2015-09-25 18:12:56 +08:00
parent 4e358cd6f4
commit 36451ddbe9
2 changed files with 7 additions and 8 deletions

View file

@ -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">';
};

View file

@ -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 = '';