Browse Source

code renderer: do not render double space before attrs

renderAttrs already adds a space before attributes

Before:

<code  class="language-python">for i in range(10):</code>

Now:

<code class="language-python">for i in range(10):</code>
pull/275/head
arve0 8 years ago
parent
commit
4c4b66bd57
  1. 10
      lib/renderer.js

10
lib/renderer.js

@ -19,20 +19,18 @@ var default_rules = {};
default_rules.code_inline = function (tokens, idx, options, env, slf) { default_rules.code_inline = function (tokens, idx, options, env, slf) {
var token = tokens[idx], var token = tokens[idx];
attrs = slf.renderAttrs(token);
return '<code' + (attrs ? ' ' + attrs : '') + '>' + return '<code' + slf.renderAttrs(token) + '>' +
escapeHtml(tokens[idx].content) + escapeHtml(tokens[idx].content) +
'</code>'; '</code>';
}; };
default_rules.code_block = function (tokens, idx, options, env, slf) { default_rules.code_block = function (tokens, idx, options, env, slf) {
var token = tokens[idx], var token = tokens[idx];
attrs = slf.renderAttrs(token);
return '<pre' + (attrs ? ' ' + attrs : '') + '><code>' + return '<pre' + slf.renderAttrs(token) + '><code>' +
escapeHtml(tokens[idx].content) + escapeHtml(tokens[idx].content) +
'</code></pre>\n'; '</code></pre>\n';
}; };

Loading…
Cancel
Save