@shikijs/transformers 3.22.0 → 3.23.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.
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +6 -3
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -214,7 +214,7 @@ interface TransformerRenderWhitespaceOptions {
|
|
|
214
214
|
* Position of rendered whitespace
|
|
215
215
|
* @default all position
|
|
216
216
|
*/
|
|
217
|
-
position?: 'all' | 'boundary' | 'trailing';
|
|
217
|
+
position?: 'all' | 'boundary' | 'trailing' | 'leading';
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* Render whitespaces as separate tokens.
|
package/dist/index.mjs
CHANGED
|
@@ -364,7 +364,8 @@ function transformerNotationErrorLevel(options = {}) {
|
|
|
364
364
|
const {
|
|
365
365
|
classMap = {
|
|
366
366
|
error: ["highlighted", "error"],
|
|
367
|
-
warning: ["highlighted", "warning"]
|
|
367
|
+
warning: ["highlighted", "warning"],
|
|
368
|
+
info: ["highlighted", "info"]
|
|
368
369
|
},
|
|
369
370
|
classActivePre = "has-highlighted",
|
|
370
371
|
classActiveCode
|
|
@@ -669,7 +670,7 @@ function splitSpaces(parts, type, renderContinuousSpaces = true) {
|
|
|
669
670
|
return parts;
|
|
670
671
|
let leftCount = 0;
|
|
671
672
|
let rightCount = 0;
|
|
672
|
-
if (type === "boundary") {
|
|
673
|
+
if (type === "boundary" || type === "leading") {
|
|
673
674
|
for (let i = 0; i < parts.length; i++) {
|
|
674
675
|
if (isSpace(parts[i]))
|
|
675
676
|
leftCount++;
|
|
@@ -720,13 +721,15 @@ function transformerRenderWhitespace(options = {}) {
|
|
|
720
721
|
return token;
|
|
721
722
|
if (position === "trailing" && index !== last)
|
|
722
723
|
return token;
|
|
724
|
+
if (position === "leading" && index !== 0)
|
|
725
|
+
return token;
|
|
723
726
|
const node = token.children[0];
|
|
724
727
|
if (node.type !== "text" || !node.value)
|
|
725
728
|
return token;
|
|
726
729
|
const parts = splitSpaces(
|
|
727
730
|
node.value.split(/([ \t])/).filter((i) => i.length),
|
|
728
731
|
position === "boundary" && index === last && last !== 0 ? "trailing" : position,
|
|
729
|
-
position !== "trailing"
|
|
732
|
+
position !== "trailing" && position !== "leading"
|
|
730
733
|
);
|
|
731
734
|
if (parts.length <= 1)
|
|
732
735
|
return token;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/transformers",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.23.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.
|
|
31
|
-
"@shikijs/types": "3.
|
|
30
|
+
"@shikijs/core": "3.23.0",
|
|
31
|
+
"@shikijs/types": "3.23.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "unbuild",
|