Browse Source

Deep copy `token.attrs` to avoid mutating token stream

pull/745/head
Taneli Hukkinen 4 years ago
committed by GitHub
parent
commit
fc1cf8fe27
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/renderer.js

2
lib/renderer.js

@ -64,7 +64,7 @@ default_rules.fence = function (tokens, idx, options, env, slf) {
// now we prefer to keep things local.
if (info) {
i = token.attrIndex('class');
tmpAttrs = token.attrs ? token.attrs.slice() : [];
tmpAttrs = token.attrs ? JSON.parse(JSON.stringify(token.attrs)) : [];
if (i < 0) {
tmpAttrs.push([ 'class', options.langPrefix + langName ]);

Loading…
Cancel
Save