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