|
@ -9,8 +9,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var assign = require('./common/utils').assign; |
|
|
var assign = require('./common/utils').assign; |
|
|
var unescapeMd = require('./common/utils').unescapeMd; |
|
|
var unescapeAll = require('./common/utils').unescapeAll; |
|
|
var replaceEntities = require('./common/utils').replaceEntities; |
|
|
|
|
|
var escapeHtml = require('./common/utils').escapeHtml; |
|
|
var escapeHtml = require('./common/utils').escapeHtml; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +38,7 @@ rules.fence = function (tokens, idx, options /*, env, self*/) { |
|
|
var highlighted; |
|
|
var highlighted; |
|
|
|
|
|
|
|
|
if (token.params) { |
|
|
if (token.params) { |
|
|
langName = escapeHtml(replaceEntities(unescapeMd(token.params.split(/\s+/g)[0]))); |
|
|
langName = escapeHtml(unescapeAll(token.params.split(/\s+/g)[0])); |
|
|
langClass = ' class="' + langPrefix + langName + '"'; |
|
|
langClass = ' class="' + langPrefix + langName + '"'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -101,7 +100,7 @@ rules.paragraph_close = function (tokens, idx /*, options, env */) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rules.link_open = function (tokens, idx /*, options, env */) { |
|
|
rules.link_open = function (tokens, idx /*, options, env */) { |
|
|
var title = tokens[idx].title ? (' title="' + escapeHtml(replaceEntities(tokens[idx].title)) + '"') : ''; |
|
|
var title = tokens[idx].title ? (' title="' + escapeHtml(tokens[idx].title) + '"') : ''; |
|
|
var target = tokens[idx].target ? (' target="' + escapeHtml(tokens[idx].target) + '"') : ''; |
|
|
var target = tokens[idx].target ? (' target="' + escapeHtml(tokens[idx].target) + '"') : ''; |
|
|
return '<a href="' + escapeHtml(tokens[idx].href) + '"' + title + target + '>'; |
|
|
return '<a href="' + escapeHtml(tokens[idx].href) + '"' + title + target + '>'; |
|
|
}; |
|
|
}; |
|
@ -112,7 +111,7 @@ rules.link_close = function (/* tokens, idx, options, env */) { |
|
|
|
|
|
|
|
|
rules.image = function (tokens, idx, options, env, self) { |
|
|
rules.image = function (tokens, idx, options, env, self) { |
|
|
var src = ' src="' + escapeHtml(tokens[idx].src) + '"'; |
|
|
var src = ' src="' + escapeHtml(tokens[idx].src) + '"'; |
|
|
var title = tokens[idx].title ? (' title="' + escapeHtml(replaceEntities(tokens[idx].title)) + '"') : ''; |
|
|
var title = tokens[idx].title ? (' title="' + escapeHtml(tokens[idx].title) + '"') : ''; |
|
|
var alt = ' alt="' + self.renderInlineAsText(tokens[idx].tokens, options, env) + '"'; |
|
|
var alt = ' alt="' + self.renderInlineAsText(tokens[idx].tokens, options, env) + '"'; |
|
|
var suffix = options.xhtmlOut ? ' /' : ''; |
|
|
var suffix = options.xhtmlOut ? ' /' : ''; |
|
|
return '<img' + src + alt + title + suffix + '>'; |
|
|
return '<img' + src + alt + title + suffix + '>'; |
|
|