|
|
@ -53,17 +53,21 @@ rules.code = function (tokens, idx /*, options*/) { |
|
|
|
|
|
|
|
rules.fence = function (tokens, idx, options) { |
|
|
|
var token = tokens[idx]; |
|
|
|
var langMark = ''; |
|
|
|
var langClass = ''; |
|
|
|
var langPrefix = options.langprefix || ''; |
|
|
|
var params; |
|
|
|
var params, langName = ''; |
|
|
|
var highlighted; |
|
|
|
|
|
|
|
if (token.params) { |
|
|
|
params = token.params.split(/ +/g); |
|
|
|
langMark = ' class="' + langPrefix + escapeHtml(replaceEntities(unescapeMd(params[0]))) + '"'; |
|
|
|
langName = escapeHtml(replaceEntities(unescapeMd(params[0]))); |
|
|
|
langClass = ' class="' + langPrefix + langName + '"'; |
|
|
|
} |
|
|
|
|
|
|
|
return '<pre><code' + langMark + '>' |
|
|
|
+ escapeHtml(token.content) |
|
|
|
highlighted = options.highlight(token.content, langName) || escapeHtml(token.content); |
|
|
|
|
|
|
|
return '<pre><code' + langClass + '>' |
|
|
|
+ highlighted |
|
|
|
+ '</code></pre>' + getBreak(tokens, idx); |
|
|
|
}; |
|
|
|
|
|
|
|