@shikijs/core 2.1.0 → 2.2.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.mjs +6 -6
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -384,7 +384,7 @@ function transformerDecorations() {
|
|
|
384
384
|
return el;
|
|
385
385
|
}
|
|
386
386
|
const lineApplies = [];
|
|
387
|
-
const sorted = ctx.decorations.sort((a, b) => b.start.offset - a.start.offset);
|
|
387
|
+
const sorted = ctx.decorations.sort((a, b) => b.start.offset - a.start.offset || a.end.offset - b.end.offset);
|
|
388
388
|
for (const decoration of sorted) {
|
|
389
389
|
const { start, end } = decoration;
|
|
390
390
|
if (start.line === end.line) {
|
|
@@ -407,12 +407,12 @@ function verifyIntersections(items) {
|
|
|
407
407
|
throw new ShikiError(`Invalid decoration range: ${JSON.stringify(foo.start)} - ${JSON.stringify(foo.end)}`);
|
|
408
408
|
for (let j = i + 1; j < items.length; j++) {
|
|
409
409
|
const bar = items[j];
|
|
410
|
-
const isFooHasBarStart = foo.start.offset
|
|
411
|
-
const isFooHasBarEnd = foo.start.offset < bar.end.offset && bar.end.offset
|
|
412
|
-
const isBarHasFooStart = bar.start.offset
|
|
413
|
-
const isBarHasFooEnd = bar.start.offset < foo.end.offset && foo.end.offset
|
|
410
|
+
const isFooHasBarStart = foo.start.offset <= bar.start.offset && bar.start.offset < foo.end.offset;
|
|
411
|
+
const isFooHasBarEnd = foo.start.offset < bar.end.offset && bar.end.offset <= foo.end.offset;
|
|
412
|
+
const isBarHasFooStart = bar.start.offset <= foo.start.offset && foo.start.offset < bar.end.offset;
|
|
413
|
+
const isBarHasFooEnd = bar.start.offset < foo.end.offset && foo.end.offset <= bar.end.offset;
|
|
414
414
|
if (isFooHasBarStart || isFooHasBarEnd || isBarHasFooStart || isBarHasFooEnd) {
|
|
415
|
-
if (
|
|
415
|
+
if (isFooHasBarStart && isFooHasBarEnd)
|
|
416
416
|
continue;
|
|
417
417
|
if (isBarHasFooStart && isBarHasFooEnd)
|
|
418
418
|
continue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shikijs/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"description": "Core of Shiki",
|
|
6
6
|
"author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"@shikijs/vscode-textmate": "^10.0.1",
|
|
64
64
|
"@types/hast": "^3.0.4",
|
|
65
65
|
"hast-util-to-html": "^9.0.4",
|
|
66
|
-
"@shikijs/engine-javascript": "2.
|
|
67
|
-
"@shikijs/engine-oniguruma": "2.
|
|
68
|
-
"@shikijs/types": "2.
|
|
66
|
+
"@shikijs/engine-javascript": "2.2.0",
|
|
67
|
+
"@shikijs/engine-oniguruma": "2.2.0",
|
|
68
|
+
"@shikijs/types": "2.2.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "unbuild",
|