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) {
var token = tokens[idx],
attrs = slf.renderAttrs(token);
var token = tokens[idx];
return '<code' + (attrs ? ' ' + attrs : '') + '>' +
return '<code' + slf.renderAttrs(token) + '>' +
escapeHtml(tokens[idx].content) +
'</code>';
};
default_rules.code_block = function (tokens, idx, options, env, slf) {
var token = tokens[idx],
attrs = slf.renderAttrs(token);
var token = tokens[idx];
return '<pre' + (attrs ? ' ' + attrs : '') + '><code>' +
return '<pre' + slf.renderAttrs(token) + '><code>' +
escapeHtml(tokens[idx].content) +
'</code></pre>\n';
};

Loading…
Cancel
Save