Skip to content

Commit f497cbe

Browse files
author
Nicolas Dorseuil
committed
Merge remote-tracking branch 'origin/main' into gbo/rnd-7359
2 parents 49c3d72 + f3448de commit f497cbe

File tree

21 files changed

+168
-49
lines changed

21 files changed

+168
-49
lines changed

.changeset/brown-ducks-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Hide scrollbar on sections

.changeset/plenty-laws-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": minor
3+
---
4+
5+
Add support for site customization option to change how external links open.

.changeset/spotty-apples-crash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@gitbook/openapi-parser': patch
3+
'@gitbook/react-openapi': patch
4+
---
5+
6+
Optional label in OpenAPI x-codeSamples

bun.lock

Lines changed: 71 additions & 21 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"workspaces": {
3737
"packages": ["packages/*"],
3838
"catalog": {
39-
"@gitbook/api": "^0.122.0"
39+
"@gitbook/api": "^0.123.0"
4040
}
4141
},
4242
"patchedDependencies": {

packages/gitbook-v2/openNext/customWorkers/defaultWrangler.jsonc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@
122122
]
123123
},
124124
"production": {
125+
"vars": {
126+
// This is a bit misleading, but it means that we can have 500 concurrent revalidations
127+
// This means that we'll have up to 100 durable objects instance running at the same time
128+
"MAX_REVALIDATE_CONCURRENCY": "100"
129+
},
125130
"r2_buckets": [
126131
{
127132
"binding": "NEXT_INC_CACHE_R2_BUCKET",

packages/gitbook-v2/openNext/customWorkers/doWrangler.jsonc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@
9898
},
9999
"production": {
100100
"vars": {
101+
// R2 is strongly consistent, so we can disable SQLite
101102
"NEXT_CACHE_DO_QUEUE_DISABLE_SQLITE": "true",
103+
// We don't want to pollute the memory with broken cache entries
104+
// Most of the time, those are fake requests.
105+
"NEXT_CACHE_DO_QUEUE_MAX_RETRIES": "1",
102106
"STAGE": "production"
103107
},
104108
"r2_buckets": [

packages/gitbook-v2/src/lib/links.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ describe('toPathInSpace', () => {
3535
expect(variantInSection.toPathInSpace('some/path/')).toBe('/section/variant/some/path');
3636
});
3737

38-
it('should not add a trailing slash', () => {
39-
expect(root.toPathInSpace('')).toBe('');
38+
it('should not add an unnecessary trailing slash', () => {
39+
// The index page should not be an empty path
40+
expect(root.toPathInSpace('')).toBe('/');
4041
expect(variantInSection.toPathInSpace('')).toBe('/section/variant');
4142
});
4243
});
@@ -52,8 +53,9 @@ describe('toPathInSite', () => {
5253
expect(siteGitBookIO.toPathInSite('some/path/')).toBe('/sitename/some/path');
5354
});
5455

55-
it('should not add a trailing slash', () => {
56-
expect(root.toPathInSite('')).toBe('');
56+
it('should not add an unnecessary trailing slash', () => {
57+
// The index page should not be an empty path
58+
expect(root.toPathInSite('')).toBe('/');
5759
expect(siteGitBookIO.toPathInSite('')).toBe('/sitename');
5860
});
5961
});

packages/gitbook-v2/src/lib/links.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ export function createLinker(
128128
function joinPaths(prefix: string, path: string): string {
129129
const prefixPath = prefix.endsWith('/') ? prefix : `${prefix}/`;
130130
const suffixPath = path.startsWith('/') ? path.slice(1) : path;
131-
return removeTrailingSlash(prefixPath + suffixPath);
131+
const pathWithoutTrailingSlash = removeTrailingSlash(prefixPath + suffixPath);
132+
return pathWithoutTrailingSlash === '' ? '/' : pathWithoutTrailingSlash;
132133
}
133134

134135
function removeTrailingSlash(path: string): string {

packages/gitbook/e2e/util.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
CustomizationThemeMode,
1717
type CustomizationThemedColor,
1818
type SiteCustomizationSettings,
19+
SiteExternalLinksTarget,
1920
} from '@gitbook/api';
2021
import { type BrowserContext, type Page, type Response, expect, test } from '@playwright/test';
2122
import deepMerge from 'deepmerge';
@@ -317,6 +318,9 @@ export function getCustomizationURL(partial: DeepPartial<SiteCustomizationSettin
317318
aiSearch: {
318319
enabled: true,
319320
},
321+
externalLinks: {
322+
target: SiteExternalLinksTarget.Self,
323+
},
320324
advancedCustomization: {
321325
enabled: true,
322326
},

0 commit comments

Comments
 (0)