@shikijs/transformers 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +12 -2
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -469,8 +469,18 @@ function transformerRemoveLineBreak() {
469
469
  function transformerRemoveNotationEscape() {
470
470
  return {
471
471
  name: "@shikijs/transformers:remove-notation-escape",
472
- postprocess(code) {
473
- return code.replace(/\[\\!code/g, "[!code");
472
+ code(hast) {
473
+ function replace(node) {
474
+ if (node.type === "text") {
475
+ node.value = node.value.replace("\\[!code", "[!code");
476
+ } else if ("children" in node) {
477
+ for (const child of node.children) {
478
+ replace(child);
479
+ }
480
+ }
481
+ }
482
+ replace(hast);
483
+ return hast;
474
484
  }
475
485
  };
476
486
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/transformers",
3
3
  "type": "module",
4
- "version": "3.3.0",
4
+ "version": "3.4.1",
5
5
  "description": "Collective of common transformers transformers for Shiki",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -27,8 +27,8 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@shikijs/core": "3.3.0",
31
- "@shikijs/types": "3.3.0"
30
+ "@shikijs/core": "3.4.1",
31
+ "@shikijs/types": "3.4.1"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "unbuild",