@shikijs/transformers 3.2.2 → 3.4.0

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 +2 -2
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -544,10 +544,10 @@ function transformerRenderWhitespace(options = {}) {
544
544
  // We use `root` hook here to ensure it runs after all other transformers
545
545
  root(root) {
546
546
  const pre = root.children[0];
547
- const code = pre.children[0];
547
+ const code = pre.tagName === "pre" ? pre.children[0] : { children: [root] };
548
548
  code.children.forEach(
549
549
  (line) => {
550
- if (line.type !== "element")
550
+ if (line.type !== "element" && line.type !== "root")
551
551
  return;
552
552
  const elements = line.children.filter((token) => token.type === "element");
553
553
  const last = elements.length - 1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/transformers",
3
3
  "type": "module",
4
- "version": "3.2.2",
4
+ "version": "3.4.0",
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.2.2",
31
- "@shikijs/types": "3.2.2"
30
+ "@shikijs/core": "3.4.0",
31
+ "@shikijs/types": "3.4.0"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "unbuild",