Skip to content

Commit

Permalink
Avoid fenced token mutation, #745
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Dec 20, 2020
1 parent be22253 commit c9949dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [12.0.4] - WIP
### Fixed
- Fix crash introduced in `12.0.3` when processing strikethrough (`~~`) and similar plugins, #742.
- Avoid fenced token mutation, #745.


## [12.0.3] - 2020-12-07
Expand Down Expand Up @@ -550,6 +551,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed presets folder (configs -> presets).


[12.0.4]: https://github.com/markdown-it/markdown-it/compare/12.0.3...12.0.4
[12.0.3]: https://github.com/markdown-it/markdown-it/compare/12.0.2...12.0.3
[12.0.2]: https://github.com/markdown-it/markdown-it/compare/12.0.1...12.0.2
[12.0.1]: https://github.com/markdown-it/markdown-it/compare/12.0.0...12.0.1
Expand Down
3 changes: 2 additions & 1 deletion lib/renderer.js
Expand Up @@ -60,7 +60,7 @@ default_rules.fence = function (tokens, idx, options, env, slf) {
}

// If language exists, inject class gently, without modifying original token.
// May be, one day we will add .clone() for token and simplify this part, but
// May be, one day we will add .deepClone() for token and simplify this part, but
// now we prefer to keep things local.
if (info) {
i = token.attrIndex('class');
Expand All @@ -69,6 +69,7 @@ default_rules.fence = function (tokens, idx, options, env, slf) {
if (i < 0) {
tmpAttrs.push([ 'class', options.langPrefix + langName ]);
} else {
tmpAttrs[i] = tmpAttrs[i].slice();
tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
}

Expand Down

0 comments on commit c9949dd

Please sign in to comment.