diff --git a/bun.lock b/bun.lock index ff7363027..ba33d4fb1 100644 --- a/bun.lock +++ b/bun.lock @@ -7,8 +7,8 @@ "devDependencies": { "@biomejs/biome": "^1.9.4", "@changesets/cli": "^2.29.8", - "turbo": "^2.8.6", - "vercel": "^50.15.1", + "turbo": "^2.8.10", + "vercel": "^50.23.2", }, }, "packages/browser-types": { @@ -347,7 +347,7 @@ "react-dom": "catalog:", }, "catalog": { - "@gitbook/api": "0.164.0", + "@gitbook/api": "0.165.0", "@scalar/api-client-react": "^1.3.46", "@tsconfig/node20": "^20.1.6", "@tsconfig/strictest": "^2.0.6", @@ -744,7 +744,7 @@ "@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@7.1.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "7.1.0" } }, "sha512-fNxRUk1KhjSbnbuBxlWSnBLKLBNun52ZBTcs22H/xEEzM6Ap81ZFTQ4bZBxVQGQgVY0xugKGoRcCbaKjLQ3XZA=="], - "@gitbook/api": ["@gitbook/api@0.164.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-u0npCEK253qSbn118YMMi1E5dqrLQnBlXnovXOpbzQP8BF62ktrndnhtH8AhTvV4ld9UHDKjCaxxidmtuYoU9g=="], + "@gitbook/api": ["@gitbook/api@0.165.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-FzdaQUrG/XEMuUiYUPold/xPKMOYQt/wBJXK+ChQh1B10KHoQOdDPezmK56WZewNHeFHcErOERcNfgQ5MdZsfQ=="], "@gitbook/browser-types": ["@gitbook/browser-types@workspace:packages/browser-types"], diff --git a/package.json b/package.json index 6c23aa61b..dc14a7479 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "catalog": { "@tsconfig/strictest": "^2.0.6", "@tsconfig/node20": "^20.1.6", - "@gitbook/api": "0.164.0", + "@gitbook/api": "0.165.0", "@scalar/api-client-react": "^1.3.46", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", diff --git a/packages/gitbook/src/lib/references.tsx b/packages/gitbook/src/lib/references.tsx index 672004ae4..5079f12b2 100644 --- a/packages/gitbook/src/lib/references.tsx +++ b/packages/gitbook/src/lib/references.tsx @@ -30,6 +30,7 @@ import { getGitBookAppHref } from './app'; import { getBlockById, getBlockTitle } from './document'; import { resolvePageId } from './pages'; import { findSiteSpaceBy, getFallbackSiteSpacePath } from './sites'; +import { getRevisionTags, resolveTag } from './tags'; import type { ClassValue } from './tailwind'; import { filterOutNullable } from './typescript'; @@ -346,6 +347,24 @@ export async function resolveContentRef( }; } + case 'tag': { + if (isContentRefInDifferentSpace(contentRef, context)) { + return resolveContentRefInSpace(contentRef.space, context, contentRef, options); + } + + const tag = resolveTag(contentRef.tag, getRevisionTags(revision)); + if (!tag) { + return null; + } + + return { + href: linker.toPathInSpace(''), + text: tag.label, + active: false, + space, + }; + } + default: assertNever(contentRef); }