├── .nvmrc ├── packages ├── expr │ ├── .gitignore │ ├── README.md │ ├── src │ │ ├── symbols │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── errors.ts │ │ └── utils.ts │ ├── tsconfig.json │ └── CHANGELOG.md ├── gitbook │ ├── README.md │ ├── src │ │ ├── components │ │ │ ├── Ads │ │ │ │ ├── index.ts │ │ │ │ └── AdPixels.tsx │ │ │ ├── Footer │ │ │ │ └── index.ts │ │ │ ├── PageAside │ │ │ │ └── index.ts │ │ │ ├── PageIcon │ │ │ │ ├── index.ts │ │ │ │ └── PageIcon.tsx │ │ │ ├── Cookies │ │ │ │ └── index.ts │ │ │ ├── DocumentView │ │ │ │ ├── Table │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── styles.ts │ │ │ │ │ └── ViewCards.tsx │ │ │ │ ├── Tabs │ │ │ │ │ └── index.ts │ │ │ │ ├── Columns │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ ├── Annotation │ │ │ │ │ └── index.ts │ │ │ │ ├── Expandable │ │ │ │ │ └── index.ts │ │ │ │ ├── InlineLink │ │ │ │ │ └── index.ts │ │ │ │ ├── Integration │ │ │ │ │ └── index.ts │ │ │ │ ├── CodeBlock │ │ │ │ │ ├── index.ts │ │ │ │ │ └── PlainCodeBlock.tsx │ │ │ │ ├── utils │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── textAlignment.ts │ │ │ │ │ └── isBlockOffscreen.test.ts │ │ │ │ ├── OpenAPI │ │ │ │ │ └── index.ts │ │ │ │ ├── InlineExpression │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── types.ts │ │ │ │ │ ├── InlineExpressionValue.tsx │ │ │ │ │ └── InlineExpression.tsx │ │ │ │ ├── Emoji.tsx │ │ │ │ ├── Divider.tsx │ │ │ │ ├── Stepper.tsx │ │ │ │ ├── Updates.tsx │ │ │ │ ├── Paragraph.tsx │ │ │ │ ├── Quote.tsx │ │ │ │ ├── InlineIcon.tsx │ │ │ │ ├── FileIcon.tsx │ │ │ │ ├── Math.tsx │ │ │ │ └── Mention.tsx │ │ │ ├── PageContext │ │ │ │ ├── index.ts │ │ │ │ └── PageContext.tsx │ │ │ ├── SpaceLayout │ │ │ │ ├── index.ts │ │ │ │ └── SpaceLayoutContext.tsx │ │ │ ├── primitives │ │ │ │ ├── Emoji │ │ │ │ │ ├── index.ts │ │ │ │ │ └── Emoji.tsx │ │ │ │ ├── index.ts │ │ │ │ ├── StyledLink.tsx │ │ │ │ └── StyleProvider.tsx │ │ │ ├── Integrations │ │ │ │ └── index.ts │ │ │ ├── PageFeedback │ │ │ │ └── index.ts │ │ │ ├── ThemeToggler │ │ │ │ └── index.ts │ │ │ ├── RootLayout │ │ │ │ ├── index.ts │ │ │ │ └── RootLayoutClientContexts.tsx │ │ │ ├── AutoRefreshContent │ │ │ │ └── index.ts │ │ │ ├── utils │ │ │ │ ├── index.ts │ │ │ │ ├── isAIChatEnabled.ts │ │ │ │ ├── ZoomImage.module.css │ │ │ │ ├── types.ts │ │ │ │ ├── link.ts │ │ │ │ └── dates.ts │ │ │ ├── Header │ │ │ │ ├── index.ts │ │ │ │ └── HeaderLinks.tsx │ │ │ ├── AI │ │ │ │ ├── server-actions │ │ │ │ │ ├── index.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── index.ts │ │ │ │ └── useAIMessageContext.ts │ │ │ ├── SiteLayout │ │ │ │ └── index.ts │ │ │ ├── Announcement │ │ │ │ ├── index.ts │ │ │ │ ├── constants.ts │ │ │ │ └── Announcement.tsx │ │ │ ├── PDF │ │ │ │ ├── index.ts │ │ │ │ ├── pdf.css │ │ │ │ ├── PrintButton.tsx │ │ │ │ └── PDFRootLayout.tsx │ │ │ ├── PageBody │ │ │ │ ├── index.ts │ │ │ │ └── OptionalSuspense.tsx │ │ │ ├── Search │ │ │ │ ├── index.ts │ │ │ │ └── isQuestion.ts │ │ │ ├── Adaptive │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── SiteSections │ │ │ │ ├── index.ts │ │ │ │ └── SectionIcon.tsx │ │ │ ├── SitePage │ │ │ │ ├── index.ts │ │ │ │ └── SitePageSkeleton.tsx │ │ │ ├── Insights │ │ │ │ ├── index.ts │ │ │ │ ├── utils.ts │ │ │ │ ├── cookies.ts │ │ │ │ └── TrackPageViewEvent.tsx │ │ │ ├── Embeddable │ │ │ │ ├── index.ts │ │ │ │ ├── EmbeddableAssistantPage.tsx │ │ │ │ └── EmbeddableDocsPageControlButtons.tsx │ │ │ ├── AIChat │ │ │ │ ├── index.ts │ │ │ │ └── AIChatControlButton.tsx │ │ │ ├── AdminToolbar │ │ │ │ ├── index.ts │ │ │ │ ├── IframeWrapper.tsx │ │ │ │ └── ToolbarControlsContext.tsx │ │ │ ├── TableOfContents │ │ │ │ └── index.ts │ │ │ ├── hooks │ │ │ │ ├── useIsMounted.ts │ │ │ │ ├── usePrevious.ts │ │ │ │ ├── index.ts │ │ │ │ ├── useCurrentPagePath.ts │ │ │ │ ├── useNow.ts │ │ │ │ ├── useCurrentPageMetadata.tsx │ │ │ │ ├── useScrollPage.ts │ │ │ │ └── useIsMobile.tsx │ │ │ └── layout.ts │ │ ├── lib │ │ │ ├── env │ │ │ │ └── index.ts │ │ │ ├── browser │ │ │ │ ├── index.ts │ │ │ │ └── security-error.ts │ │ │ ├── images │ │ │ │ ├── resizer │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── utils.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── index.ts │ │ │ │ ├── utils.ts │ │ │ │ ├── getImageResizingContextId.ts │ │ │ │ ├── types.ts │ │ │ │ └── getImageResizingContextId.test.ts │ │ │ ├── build.ts │ │ │ ├── data │ │ │ │ ├── index.ts │ │ │ │ ├── cloudflare.ts │ │ │ │ ├── pages.ts │ │ │ │ └── visitor.ts │ │ │ ├── tailwind.ts │ │ │ ├── assets.ts │ │ │ ├── preview.ts │ │ │ ├── emojis.ts │ │ │ ├── paths.test.ts │ │ │ ├── arrays.ts │ │ │ ├── urls.ts │ │ │ ├── app.ts │ │ │ ├── markdown.ts │ │ │ ├── openapi │ │ │ │ └── enrich.test.ts │ │ │ ├── files.ts │ │ │ ├── adaptive.ts │ │ │ ├── csp.ts │ │ │ ├── emojis.test.ts │ │ │ ├── embeddable.test.ts │ │ │ ├── preview.test.ts │ │ │ ├── typescript.ts │ │ │ └── server-actions.ts │ │ ├── fonts │ │ │ ├── Inter │ │ │ │ ├── Inter-Bold.ttf │ │ │ │ └── Inter-Regular.ttf │ │ │ └── ABCFavorit │ │ │ │ ├── ABCFavorit-Bold.otf │ │ │ │ ├── ABCFavorit-Book.otf │ │ │ │ ├── ABCFavorit-Bold.woff │ │ │ │ ├── ABCFavorit-Bold.woff2 │ │ │ │ ├── ABCFavorit-Book.woff │ │ │ │ ├── ABCFavorit-Book.woff2 │ │ │ │ ├── ABCFavorit-Light.otf │ │ │ │ ├── ABCFavorit-Light.woff │ │ │ │ ├── ABCFavorit-Light.woff2 │ │ │ │ ├── ABCFavorit-Medium.otf │ │ │ │ ├── ABCFavorit-Medium.woff │ │ │ │ ├── ABCFavorit-Regular.otf │ │ │ │ ├── ABCFavorit-Medium.woff2 │ │ │ │ ├── ABCFavorit-Regular.woff │ │ │ │ ├── ABCFavorit-Regular.woff2 │ │ │ │ ├── ABCFavorit-Variable.ttf │ │ │ │ ├── ABCFavorit-Variable.woff │ │ │ │ ├── ABCFavorit-BoldItalic.otf │ │ │ │ ├── ABCFavorit-BoldItalic.woff │ │ │ │ ├── ABCFavorit-BoldItalic.woff2 │ │ │ │ ├── ABCFavorit-BookItalic.otf │ │ │ │ ├── ABCFavorit-BookItalic.woff │ │ │ │ ├── ABCFavorit-BookItalic.woff2 │ │ │ │ ├── ABCFavorit-LightItalic.otf │ │ │ │ ├── ABCFavorit-LightItalic.woff │ │ │ │ ├── ABCFavorit-MediumItalic.otf │ │ │ │ ├── ABCFavorit-Variable.woff2 │ │ │ │ ├── ABCFavorit-LightItalic.woff2 │ │ │ │ ├── ABCFavorit-MediumItalic.woff │ │ │ │ ├── ABCFavorit-MediumItalic.woff2 │ │ │ │ ├── ABCFavorit-RegularItalic.otf │ │ │ │ ├── ABCFavorit-RegularItalic.woff │ │ │ │ └── ABCFavorit-RegularItalic.woff2 │ │ ├── app │ │ │ ├── ~space │ │ │ │ └── [spaceId] │ │ │ │ │ ├── ~ │ │ │ │ │ ├── changes │ │ │ │ │ │ └── [changeRequestId] │ │ │ │ │ │ │ └── ~gitbook │ │ │ │ │ │ │ └── pdf │ │ │ │ │ │ │ ├── layout.tsx │ │ │ │ │ │ │ └── page.tsx │ │ │ │ │ └── revisions │ │ │ │ │ │ └── [changeRequestId] │ │ │ │ │ │ └── ~gitbook │ │ │ │ │ │ └── pdf │ │ │ │ │ │ ├── layout.tsx │ │ │ │ │ │ └── page.tsx │ │ │ │ │ └── ~gitbook │ │ │ │ │ └── pdf │ │ │ │ │ ├── layout.tsx │ │ │ │ │ └── page.tsx │ │ │ ├── sites │ │ │ │ ├── dynamic │ │ │ │ │ └── [mode] │ │ │ │ │ │ └── [siteURL] │ │ │ │ │ │ └── [siteData] │ │ │ │ │ │ ├── (content) │ │ │ │ │ │ └── [pagePath] │ │ │ │ │ │ │ ├── loading.tsx │ │ │ │ │ │ │ └── not-found.tsx │ │ │ │ │ │ └── ~gitbook │ │ │ │ │ │ ├── icon │ │ │ │ │ │ └── route.ts │ │ │ │ │ │ ├── pdf │ │ │ │ │ │ ├── layout.tsx │ │ │ │ │ │ └── page.tsx │ │ │ │ │ │ ├── ogimage │ │ │ │ │ │ └── [pageId] │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ │ └── embed │ │ │ │ │ │ ├── page.tsx │ │ │ │ │ │ ├── assistant │ │ │ │ │ │ └── page.tsx │ │ │ │ │ │ └── page │ │ │ │ │ │ └── [pagePath] │ │ │ │ │ │ └── page.tsx │ │ │ │ └── static │ │ │ │ │ └── [mode] │ │ │ │ │ └── [siteURL] │ │ │ │ │ └── [siteData] │ │ │ │ │ ├── (content) │ │ │ │ │ └── [pagePath] │ │ │ │ │ │ └── not-found.tsx │ │ │ │ │ ├── ~gitbook │ │ │ │ │ ├── icon │ │ │ │ │ │ └── route.ts │ │ │ │ │ ├── rss │ │ │ │ │ │ └── [pagePath] │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ ├── markdown │ │ │ │ │ │ └── [pagePath] │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ ├── ogimage │ │ │ │ │ │ └── [pageId] │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ └── embed │ │ │ │ │ │ ├── page.tsx │ │ │ │ │ │ ├── assistant │ │ │ │ │ │ └── page.tsx │ │ │ │ │ │ └── page │ │ │ │ │ │ └── [pagePath] │ │ │ │ │ │ └── page.tsx │ │ │ │ │ ├── robots.txt │ │ │ │ │ └── route.ts │ │ │ │ │ ├── sitemap.xml │ │ │ │ │ └── route.ts │ │ │ │ │ ├── llms-full.txt │ │ │ │ │ ├── route.ts │ │ │ │ │ └── [page] │ │ │ │ │ │ └── route.ts │ │ │ │ │ ├── sitemap-pages.xml │ │ │ │ │ └── route.ts │ │ │ │ │ └── llms.txt │ │ │ │ │ └── route.ts │ │ │ ├── global-error.tsx │ │ │ └── ~gitbook │ │ │ │ └── revalidate │ │ │ │ └── route.ts │ │ └── intl │ │ │ ├── translations │ │ │ ├── types.ts │ │ │ └── index.ts │ │ │ └── client.ts │ ├── postcss.config.js │ ├── types │ │ ├── content-security-policy-merger.d.ts │ │ ├── global.d.ts │ │ ├── memoizee.d.ts │ │ └── images.d.ts │ ├── public │ │ ├── ~gitbook │ │ │ └── static │ │ │ │ └── images │ │ │ │ ├── ogimage-grid-black.png │ │ │ │ └── ogimage-grid-white.png │ │ └── _headers │ ├── scripts │ │ ├── clean.sh │ │ └── generate.sh │ ├── tests │ │ ├── preload-bun.ts │ │ ├── rss.test.ts │ │ └── mcp.test.ts │ ├── openNext │ │ ├── queue │ │ │ ├── middleware.ts │ │ │ └── server.ts │ │ ├── incrementalCache │ │ │ ├── middleware.ts │ │ │ └── server.ts │ │ └── customWorkers │ │ │ └── script │ │ │ └── updateWrangler.ts │ ├── turbo.json │ ├── .gitignore │ └── playwright.config.ts ├── colors │ ├── .gitignore │ ├── src │ │ └── index.ts │ ├── README.md │ ├── tsconfig.json │ └── package.json ├── openapi-parser │ ├── .gitignore │ ├── src │ │ ├── fixtures │ │ │ └── remote-ref │ │ │ │ ├── root │ │ │ │ └── invalid.txt │ │ │ │ └── tag.yaml │ │ ├── helpers │ │ │ └── shouldIgnoreEntity.ts │ │ ├── index.ts │ │ ├── v2.test.ts │ │ ├── scalar-plugins │ │ │ └── fetchURL.ts │ │ ├── schemas.ts │ │ └── error.ts │ ├── README.md │ └── tsconfig.json ├── browser-types │ ├── .gitignore │ ├── README.md │ ├── tsconfig.json │ └── CHANGELOG.md ├── cache-tags │ ├── .gitignore │ ├── README.md │ ├── tsconfig.json │ ├── CHANGELOG.md │ └── package.json ├── react-math │ ├── .gitignore │ ├── src │ │ ├── index.ts │ │ ├── MathJaXLazy.tsx │ │ ├── KaTeXCSS.tsx │ │ └── KaTeX.tsx │ ├── README.md │ ├── tsdown.config.ts │ ├── css │ │ └── default.css │ ├── tsconfig.json │ └── bin │ │ └── gitbook-math.js ├── react-openapi │ ├── .gitignore │ ├── src │ │ ├── schemas │ │ │ ├── index.ts │ │ │ └── resolveOpenAPISchemas.ts │ │ ├── translations │ │ │ ├── types.ts │ │ │ └── index.ts │ │ ├── json2xml.ts │ │ ├── Markdown.tsx │ │ ├── __snapshots__ │ │ │ └── json2xml.test.ts.snap │ │ ├── index.ts │ │ ├── stringifyOpenAPI.ts │ │ ├── common │ │ │ ├── OpenAPIStability.tsx │ │ │ └── OpenAPIOperationDescription.tsx │ │ ├── getDisclosureLabel.ts │ │ ├── getOrCreateStoreByKey.ts │ │ ├── dereference.ts │ │ ├── OpenAPITooltip.tsx │ │ └── OpenAPISchemaServer.tsx │ ├── README.md │ └── tsdown.config.ts ├── emoji-codepoints │ ├── .gitignore │ ├── CHANGELOG.md │ ├── package.json │ └── build.ts ├── react-contentkit │ ├── .gitignore │ ├── src │ │ ├── index.ts │ │ ├── ElementBlock.tsx │ │ ├── ElementImage.tsx │ │ ├── ElementBox.tsx │ │ ├── ElementIcon.tsx │ │ ├── ElementDivider.tsx │ │ ├── ElementText.tsx │ │ ├── ElementStack.tsx │ │ ├── ElementCodeBlockClient.tsx │ │ ├── ElementCodeBlock.tsx │ │ ├── ContentKitOutput.tsx │ │ └── ElementMarkdown.tsx │ ├── tsdown.config.ts │ └── tsconfig.json ├── embed │ ├── .gitignore │ ├── src │ │ ├── index.ts │ │ ├── react │ │ │ ├── index.ts │ │ │ ├── context.ts │ │ │ └── GitBookProvider.tsx │ │ └── client │ │ │ └── index.ts │ ├── tsdown.config.ts │ ├── tsconfig.json │ └── CHANGELOG.md ├── fonts │ ├── .gitignore │ ├── src │ │ ├── index.ts │ │ ├── fonts.ts │ │ └── types.ts │ ├── README.md │ ├── turbo.json │ ├── CHANGELOG.md │ └── tsconfig.json └── icons │ ├── .gitignore │ ├── src │ ├── index.ts │ ├── style.css │ ├── pro.test.ts │ ├── types.ts │ ├── icons.ts │ └── getIconStyle.ts │ ├── tsdown.config.ts │ ├── README.md │ ├── turbo.json │ ├── bin │ └── kit.js │ └── tsconfig.json ├── .vscode ├── extensions.json └── settings.json ├── .changeset ├── cool-pigs-wink.md ├── funny-dodos-speak.md ├── full-coats-shave.md ├── tiny-carrots-rush.md ├── new-news-strive.md ├── ready-aliens-lose.md ├── some-bags-wish.md ├── three-melons-enjoy.md ├── ready-ducks-burn.md ├── chatty-glasses-move.md ├── tender-windows-double.md ├── eager-zoos-judge.md ├── social-berries-visit.md ├── yellow-jobs-nail.md ├── grumpy-peas-hammer.md ├── social-moles-film.md ├── five-worlds-kneel.md ├── config.json └── README.md ├── assets └── published-site.png ├── bunfig.toml ├── .github ├── CODEOWNERS ├── composite │ └── setup-bun │ │ └── action.yaml └── ISSUE_TEMPLATE │ └── bug_report.md ├── patches ├── decode-named-character-reference@1.0.2.patch └── @vercel%2Fnext@4.4.2.patch └── .gitignore /.nvmrc: -------------------------------------------------------------------------------- 1 | v22.3 2 | -------------------------------------------------------------------------------- /packages/expr/.gitignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /packages/gitbook/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/colors/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /packages/openapi-parser/.gitignore: -------------------------------------------------------------------------------- 1 | dist -------------------------------------------------------------------------------- /packages/browser-types/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /packages/cache-tags/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /packages/react-math/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /packages/react-openapi/.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /packages/emoji-codepoints/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /packages/react-contentkit/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | -------------------------------------------------------------------------------- /packages/embed/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | standalone/ 3 | -------------------------------------------------------------------------------- /packages/embed/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './client'; 2 | -------------------------------------------------------------------------------- /packages/fonts/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | src/data/*.json 3 | -------------------------------------------------------------------------------- /packages/icons/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | src/data/*.json 3 | -------------------------------------------------------------------------------- /packages/react-math/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './MathFormula'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Ads/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Ad'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Footer/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Footer'; 2 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["biomejs.biome"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/PageAside/index.ts: -------------------------------------------------------------------------------- 1 | export * from './PageAside'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/PageIcon/index.ts: -------------------------------------------------------------------------------- 1 | export * from './PageIcon'; 2 | -------------------------------------------------------------------------------- /packages/openapi-parser/src/fixtures/remote-ref/root/invalid.txt: -------------------------------------------------------------------------------- 1 | { "invalid" <> } -------------------------------------------------------------------------------- /packages/gitbook/src/components/Cookies/index.ts: -------------------------------------------------------------------------------- 1 | export * from './CookiesToast'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Table/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Table'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Tabs/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Tabs'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/PageContext/index.ts: -------------------------------------------------------------------------------- 1 | export * from './PageContext'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/SpaceLayout/index.ts: -------------------------------------------------------------------------------- 1 | export * from './SpaceLayout'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/primitives/Emoji/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Emoji'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Columns/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Columns'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/index.ts: -------------------------------------------------------------------------------- 1 | export * from './DocumentView'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Integrations/index.ts: -------------------------------------------------------------------------------- 1 | export * from './LoadIntegrations'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/PageFeedback/index.ts: -------------------------------------------------------------------------------- 1 | export * from './PageFeedbackForm'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/ThemeToggler/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ThemeToggler'; 2 | -------------------------------------------------------------------------------- /.changeset/cool-pigs-wink.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": patch 3 | --- 4 | 5 | Add Input component 6 | -------------------------------------------------------------------------------- /packages/colors/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './colors'; 2 | export * from './transformations'; 3 | -------------------------------------------------------------------------------- /packages/fonts/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './getDefaultFont'; 2 | export * from './types'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Annotation/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Annotation'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Expandable/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Expandable'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/InlineLink/index.ts: -------------------------------------------------------------------------------- 1 | export * from './InlineLink'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/RootLayout/index.ts: -------------------------------------------------------------------------------- 1 | export * from './CustomizationRootLayout'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/env/index.ts: -------------------------------------------------------------------------------- 1 | export * from './globals'; 2 | export * from './urls'; 3 | -------------------------------------------------------------------------------- /.changeset/funny-dodos-speak.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": patch 3 | --- 4 | 5 | Fix search results cursor 6 | -------------------------------------------------------------------------------- /assets/published-site.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/assets/published-site.png -------------------------------------------------------------------------------- /.changeset/full-coats-shave.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": patch 3 | --- 4 | 5 | Fix overflowing section groups 6 | -------------------------------------------------------------------------------- /.changeset/tiny-carrots-rush.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'gitbook': patch 3 | --- 4 | 5 | Fix hidden section not found 6 | -------------------------------------------------------------------------------- /packages/embed/src/react/index.ts: -------------------------------------------------------------------------------- 1 | export * from './GitBookProvider'; 2 | export * from './GitBookFrame'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/AutoRefreshContent/index.ts: -------------------------------------------------------------------------------- 1 | export * from './useCheckForContentUpdate'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Integration/index.ts: -------------------------------------------------------------------------------- 1 | export * from './IntegrationBlock'; 2 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Image'; 2 | export * from './dates'; 3 | -------------------------------------------------------------------------------- /.changeset/new-news-strive.md: -------------------------------------------------------------------------------- 1 | --- 2 | "@gitbook/icons": minor 3 | --- 4 | 5 | Update to FontAwesome 7.1.0 6 | -------------------------------------------------------------------------------- /bunfig.toml: -------------------------------------------------------------------------------- 1 | [install.scopes] 2 | "gitbook" = { token = "$BUN_NPM_TOKEN", url = "https://registry.npmjs.org" } 3 | -------------------------------------------------------------------------------- /packages/cache-tags/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/cache-tags` 2 | 3 | Utility to generate cache tags for GitBook Open. -------------------------------------------------------------------------------- /packages/expr/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/expr` 2 | 3 | Safely evaluate & parse user-defined GitBook expressions. 4 | -------------------------------------------------------------------------------- /packages/fonts/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/fonts` 2 | 3 | Utilities to lookup default fonts supported by GitBook. 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Header/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Header'; 2 | export * from './HeaderLogo'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/browser/index.ts: -------------------------------------------------------------------------------- 1 | export * from './cookies'; 2 | export * from './local-storage'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/images/resizer/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | export * from './resizeImage'; 3 | -------------------------------------------------------------------------------- /.changeset/ready-aliens-lose.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": patch 3 | --- 4 | 5 | Add customizable suggested questions 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/AI/server-actions/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | export * from './chat'; 3 | -------------------------------------------------------------------------------- /.changeset/some-bags-wish.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@gitbook/react-openapi': patch 3 | --- 4 | 5 | Fix OpenAPI oneOf/allOf merge 6 | -------------------------------------------------------------------------------- /.changeset/three-melons-enjoy.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'gitbook': patch 3 | --- 4 | 5 | Remove hidden site spaces from navigation 6 | -------------------------------------------------------------------------------- /packages/icons/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Icon'; 2 | export * from './types'; 3 | export * from './IconsProvider'; 4 | -------------------------------------------------------------------------------- /.changeset/ready-ducks-burn.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@gitbook/react-openapi': patch 3 | --- 4 | 5 | Fix OpenAPI basic auth placeholder 6 | -------------------------------------------------------------------------------- /packages/react-openapi/src/schemas/index.ts: -------------------------------------------------------------------------------- 1 | export * from './OpenAPISchemas'; 2 | export * from './resolveOpenAPISchemas'; 3 | -------------------------------------------------------------------------------- /.changeset/chatty-glasses-move.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@gitbook/react-openapi': patch 3 | --- 4 | 5 | Fix missing properties in allOf/oneOf 6 | -------------------------------------------------------------------------------- /.changeset/tender-windows-double.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": minor 3 | --- 4 | 5 | Add a RSS feed to all pages with update blocks. 6 | -------------------------------------------------------------------------------- /packages/expr/src/symbols/index.ts: -------------------------------------------------------------------------------- 1 | export * from './symbols'; 2 | export * from './symbols-table'; 3 | export * from './types'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/SiteLayout/index.ts: -------------------------------------------------------------------------------- 1 | export * from './SiteLayout'; 2 | export * from './SiteLayoutClientContexts'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | '@tailwindcss/postcss': {}, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/CodeBlock/index.ts: -------------------------------------------------------------------------------- 1 | export * from './CodeBlock'; 2 | export * from './PlainCodeBlock'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './isBlockOffscreen'; 2 | export * from './textAlignment'; 3 | -------------------------------------------------------------------------------- /packages/react-openapi/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/react-openapi` 2 | 3 | Style-less React components to render OpenAPI operation blocks. 4 | -------------------------------------------------------------------------------- /.changeset/eager-zoos-judge.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@gitbook/react-openapi': patch 3 | --- 4 | 5 | Enhance discriminator handling in OpenAPISchema 6 | -------------------------------------------------------------------------------- /.changeset/social-berries-visit.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": patch 3 | --- 4 | 5 | Fix links to other spaces and root page in embeddable view. 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Announcement/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Announcement'; 2 | export * from './AnnouncementDismissedScript'; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/PDF/index.ts: -------------------------------------------------------------------------------- 1 | export * from './PDFRootLayout'; 2 | export * from './PDFPage'; 3 | export * from './urls'; 4 | -------------------------------------------------------------------------------- /.changeset/yellow-jobs-nail.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@gitbook/react-openapi': patch 3 | 'gitbook': patch 4 | --- 5 | 6 | Improve OpenAPI circular references 7 | -------------------------------------------------------------------------------- /packages/embed/src/client/index.ts: -------------------------------------------------------------------------------- 1 | export * from './createGitBook'; 2 | export * from './createGitBookFrame'; 3 | export * from './protocol'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/Inter/Inter-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/Inter/Inter-Bold.ttf -------------------------------------------------------------------------------- /packages/colors/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/colors` 2 | 3 | A set of default colors and transformation functions used throughout the GitBook Open and app. 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/Inter/Inter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/Inter/Inter-Regular.ttf -------------------------------------------------------------------------------- /packages/gitbook/src/components/PageBody/index.ts: -------------------------------------------------------------------------------- 1 | export * from './PageBody'; 2 | export * from './PageCover'; 3 | export * from './useCoverPosition'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Search/index.ts: -------------------------------------------------------------------------------- 1 | export * from './SearchInput'; 2 | export * from './SearchContainer'; 3 | export * from './useSearch'; 4 | -------------------------------------------------------------------------------- /.changeset/grumpy-peas-hammer.md: -------------------------------------------------------------------------------- 1 | --- 2 | "@gitbook/embed": minor 3 | "gitbook": patch 4 | --- 5 | 6 | Improve Docs Embed with separate Assistant and Docs tabs 7 | -------------------------------------------------------------------------------- /.changeset/social-moles-film.md: -------------------------------------------------------------------------------- 1 | --- 2 | "gitbook": patch 3 | --- 4 | 5 | Support `greeting` and fix suggested questions if there are no custom ones defined 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Adaptive/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | export * from './utils'; 3 | export * from './AdaptiveVisitorContextProvider'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Bold.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Book.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Book.otf -------------------------------------------------------------------------------- /packages/gitbook/src/components/AI/index.ts: -------------------------------------------------------------------------------- 1 | export * from './useAI'; 2 | export * from './useAIChat'; 3 | export type { RenderAIMessageOptions } from './server-actions'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Bold.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Bold.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Book.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Book.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Book.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Book.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Light.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Light.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Light.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Medium.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Medium.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Regular.otf -------------------------------------------------------------------------------- /packages/openapi-parser/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/openapi-parser` 2 | 3 | Modern OpenAPI parser written in TypeScript with support for OpenAPI 3.1, OpenAPI 3.0 and Swagger 2.0. -------------------------------------------------------------------------------- /packages/react-contentkit/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './ContentKit'; 2 | export * from './ContentKitOutput'; 3 | export type { ContentKitServerContext } from './types'; 4 | -------------------------------------------------------------------------------- /packages/react-math/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/react-math` 2 | 3 | React component to render a Math formula. It uses KaTeX when possible and fallbacks to MathJaX if needed. 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/OpenAPI/index.ts: -------------------------------------------------------------------------------- 1 | export * from './OpenAPIOperation'; 2 | export * from './OpenAPISchemas'; 3 | export * from './OpenAPIWebhook'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Medium.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Regular.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Regular.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Variable.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Variable.ttf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Variable.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Variable.woff -------------------------------------------------------------------------------- /packages/gitbook/src/components/PDF/pdf.css: -------------------------------------------------------------------------------- 1 | @page { 2 | size: A4; 3 | margin: 60pt 60pt; 4 | 5 | @bottom-right { 6 | content: counter(page); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/SiteSections/index.ts: -------------------------------------------------------------------------------- 1 | export * from './encodeClientSiteSections'; 2 | export * from './SiteSectionList'; 3 | export * from './SiteSectionTabs'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BoldItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BoldItalic.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BoldItalic.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BoldItalic.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BookItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BookItalic.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BookItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BookItalic.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BookItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-BookItalic.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-LightItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-LightItalic.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-LightItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-LightItalic.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-MediumItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-MediumItalic.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Variable.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-Variable.woff2 -------------------------------------------------------------------------------- /packages/gitbook/types/content-security-policy-merger.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'content-security-policy-merger' { 2 | export function merge(...policies: string[]): string; 3 | } 4 | -------------------------------------------------------------------------------- /packages/gitbook/types/global.d.ts: -------------------------------------------------------------------------------- 1 | // Needed because of https://github.com/oven-sh/bun/issues/358 2 | 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-LightItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-LightItalic.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-MediumItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-MediumItalic.woff -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-MediumItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-MediumItalic.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-RegularItalic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-RegularItalic.otf -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-RegularItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-RegularItalic.woff -------------------------------------------------------------------------------- /packages/gitbook/public/~gitbook/static/images/ogimage-grid-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/public/~gitbook/static/images/ogimage-grid-black.png -------------------------------------------------------------------------------- /packages/gitbook/public/~gitbook/static/images/ogimage-grid-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/public/~gitbook/static/images/ogimage-grid-white.png -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/InlineExpression/index.ts: -------------------------------------------------------------------------------- 1 | export * from './InlineExpression'; 2 | export * from './types'; 3 | export * from './useEvaluateInlineExpression'; 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/SitePage/index.ts: -------------------------------------------------------------------------------- 1 | export * from './SitePageNotFound'; 2 | export * from './SitePage'; 3 | export * from './fetch'; 4 | export * from './SitePageSkeleton'; 5 | -------------------------------------------------------------------------------- /packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-RegularItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitbookIO/gitbook/HEAD/packages/gitbook/src/fonts/ABCFavorit/ABCFavorit-RegularItalic.woff2 -------------------------------------------------------------------------------- /packages/gitbook/src/app/~space/[spaceId]/~/changes/[changeRequestId]/~gitbook/pdf/layout.tsx: -------------------------------------------------------------------------------- 1 | import RootLayout from '@/app/~space/[spaceId]/~gitbook/pdf/layout'; 2 | export default RootLayout; 3 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Insights/index.ts: -------------------------------------------------------------------------------- 1 | export * from './InsightsProvider'; 2 | export * from './visitorId'; 3 | export * from './cookies'; 4 | export * from './TrackPageViewEvent'; 5 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/~space/[spaceId]/~/revisions/[changeRequestId]/~gitbook/pdf/layout.tsx: -------------------------------------------------------------------------------- 1 | import RootLayout from '@/app/~space/[spaceId]/~gitbook/pdf/layout'; 2 | export default RootLayout; 3 | -------------------------------------------------------------------------------- /packages/browser-types/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/browser-types` 2 | 3 | Typescript types for the global variables available in a GitBook website. These types can be used by integrations embedding scripts. 4 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/build.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Get a string representing the build version. 3 | */ 4 | export function buildVersion(): string { 5 | return process.env.BUILD_VERSION || '0.0.0'; 6 | } 7 | -------------------------------------------------------------------------------- /.changeset/five-worlds-kneel.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@gitbook/openapi-parser': patch 3 | '@gitbook/react-openapi': patch 4 | --- 5 | 6 | Add x-gitbook-prefix and x-gitbook-token-placeholder for OpenAPI security scheme 7 | -------------------------------------------------------------------------------- /packages/fonts/src/fonts.ts: -------------------------------------------------------------------------------- 1 | import type { FontDefinitions } from './types'; 2 | 3 | import rawFonts from './data/fonts.json' with { type: 'json' }; 4 | 5 | export const fonts: FontDefinitions = rawFonts; 6 | -------------------------------------------------------------------------------- /packages/react-math/tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsdown'; 2 | 3 | export default defineConfig([ 4 | { 5 | entry: 'src/index.ts', 6 | unbundle: true, 7 | }, 8 | ]); 9 | -------------------------------------------------------------------------------- /packages/react-openapi/tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsdown'; 2 | 3 | export default defineConfig([ 4 | { 5 | entry: 'src/index.ts', 6 | unbundle: true, 7 | }, 8 | ]); 9 | -------------------------------------------------------------------------------- /packages/react-contentkit/tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsdown'; 2 | 3 | export default defineConfig([ 4 | { 5 | entry: 'src/index.ts', 6 | unbundle: true, 7 | }, 8 | ]); 9 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Embeddable/index.ts: -------------------------------------------------------------------------------- 1 | export * from './EmbeddableFrame'; 2 | export * from './EmbeddableRootLayout'; 3 | export * from './EmbeddableAssistantPage'; 4 | export * from './EmbeddableDocsPage'; 5 | -------------------------------------------------------------------------------- /packages/icons/tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsdown'; 2 | 3 | export default defineConfig([ 4 | { 5 | entry: ['src/index.ts', 'src/icons.ts'], 6 | unbundle: true, 7 | }, 8 | ]); 9 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Changes to the API data cache functions can invalidate all existing data cache 2 | # causing a massive amount of revalidation, impacting our API. 3 | packages/gitbook/src/lib/data/api.ts @SamyPesse 4 | -------------------------------------------------------------------------------- /packages/react-openapi/src/translations/types.ts: -------------------------------------------------------------------------------- 1 | import type { en } from './en'; 2 | 3 | export type TranslationKey = keyof typeof en; 4 | 5 | export type Translation = { 6 | [key in TranslationKey]: string; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/AIChat/index.ts: -------------------------------------------------------------------------------- 1 | export * from './AIChat'; 2 | export * from './AIChatButton'; 3 | export * from './AIChatIcon'; 4 | export * from './AIResponseFeedback'; 5 | export * from './AIChatControlButton'; 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/intl/translations/types.ts: -------------------------------------------------------------------------------- 1 | import type { en } from './en'; 2 | 3 | export type TranslationKey = keyof typeof en; 4 | 5 | export type TranslationLanguage = { 6 | [key in TranslationKey]: string; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/embed/src/react/context.ts: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import * as React from 'react'; 4 | import type { GitBookClient } from '../client'; 5 | 6 | export const GitBookContext = React.createContext(null); 7 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/InlineExpression/types.ts: -------------------------------------------------------------------------------- 1 | import type { Variables } from '@gitbook/api'; 2 | 3 | export interface InlineExpressionVariables { 4 | space?: Variables; 5 | page?: Variables; 6 | } 7 | -------------------------------------------------------------------------------- /packages/icons/README.md: -------------------------------------------------------------------------------- 1 | # `@gitbook/icons` 2 | 3 | Icon sets useed in GitBook content. 4 | 5 | ## Usage 6 | 7 | ```tsx 8 | import { Icon } from '@gitbook/icons'; 9 | 10 | ; 11 | ``` 12 | -------------------------------------------------------------------------------- /packages/expr/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './errors'; 2 | export * from './input-values'; 3 | export * from './runtime'; 4 | export * from './symbols'; 5 | export * from './template'; 6 | export * from './types'; 7 | export * from './utils'; 8 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/~space/[spaceId]/~/changes/[changeRequestId]/~gitbook/pdf/page.tsx: -------------------------------------------------------------------------------- 1 | import PDFPage, { generateMetadata } from '@/app/~space/[spaceId]/~gitbook/pdf/page'; 2 | 3 | export default PDFPage; 4 | export { generateMetadata }; 5 | -------------------------------------------------------------------------------- /packages/gitbook/scripts/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o pipefail 5 | 6 | rm -rf ./.next 7 | rm -rf ./public/~gitbook/static/icons 8 | rm -rf ./public/~gitbook/static/math 9 | rm -rf ./public/~gitbook/static/embed 10 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/(content)/[pagePath]/loading.tsx: -------------------------------------------------------------------------------- 1 | import { SitePageSkeleton } from '@/components/SitePage'; 2 | 3 | export default function Loading() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/~space/[spaceId]/~/revisions/[changeRequestId]/~gitbook/pdf/page.tsx: -------------------------------------------------------------------------------- 1 | import PDFPage, { generateMetadata } from '@/app/~space/[spaceId]/~gitbook/pdf/page'; 2 | 3 | export default PDFPage; 4 | export { generateMetadata }; 5 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/(content)/[pagePath]/not-found.tsx: -------------------------------------------------------------------------------- 1 | import { SitePageNotFound } from '@/components/SitePage'; 2 | 3 | export default async function NotFound() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/(content)/[pagePath]/not-found.tsx: -------------------------------------------------------------------------------- 1 | import { SitePageNotFound } from '@/components/SitePage'; 2 | 3 | export default async function NotFound() { 4 | return ; 5 | } 6 | -------------------------------------------------------------------------------- /packages/icons/src/style.css: -------------------------------------------------------------------------------- 1 | /* Normal */ 2 | svg.gb-icon { 3 | background-color: currentColor; 4 | } 5 | 6 | /* Sprite */ 7 | svg.gb-icon-s path, 8 | svg.gb-icon-s use { 9 | fill: currentColor; 10 | stroke: currentColor; 11 | } 12 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/AdminToolbar/index.ts: -------------------------------------------------------------------------------- 1 | export * from './AdminToolbar'; 2 | export * from './AdminToolbarClient'; 3 | export * from './IframeWrapper'; 4 | export * from './Toolbar'; 5 | export * from './transitions'; 6 | export * from './utils'; 7 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/TableOfContents/index.ts: -------------------------------------------------------------------------------- 1 | export { TableOfContents } from './TableOfContents'; 2 | export { PagesList } from './PagesList'; 3 | export { TOCScrollContainer } from './TOCScroller'; 4 | export { Trademark } from './Trademark'; 5 | -------------------------------------------------------------------------------- /packages/fonts/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["//"], 3 | "tasks": { 4 | "generate": { 5 | "inputs": ["bin/**/*", "package.json"], 6 | "outputs": ["src/data/*.json", "dist/data/*.json"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/gitbook/tests/preload-bun.ts: -------------------------------------------------------------------------------- 1 | import { mock } from 'bun:test'; 2 | 3 | /** 4 | * Mock the `server-only` module to avoid errors when running tests as it doesn't work well in Bun 5 | */ 6 | mock.module('server-only', () => { 7 | return {}; 8 | }); 9 | -------------------------------------------------------------------------------- /packages/icons/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["//"], 3 | "tasks": { 4 | "generate": { 5 | "inputs": ["bin/**/*", "package.json"], 6 | "outputs": ["src/data/*.json", "dist/data/*.json"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/data/index.ts: -------------------------------------------------------------------------------- 1 | export * from './api'; 2 | export * from './types'; 3 | export * from './urls'; 4 | export * from './errors'; 5 | export * from './lookup'; 6 | export * from './visitor'; 7 | export * from './pages'; 8 | export * from './revisions'; 9 | -------------------------------------------------------------------------------- /packages/react-openapi/src/json2xml.ts: -------------------------------------------------------------------------------- 1 | import { jsXml } from 'json-xml-parse'; 2 | 3 | /** 4 | * This function converts an object to XML. 5 | */ 6 | export function json2xml(data: Record) { 7 | return jsXml.toXmlString(data, { beautify: true }); 8 | } 9 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/images/index.ts: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | export * from './createImageResizer'; 3 | export * from './signatures'; 4 | export * from './utils'; 5 | export * from './getImageResizingContextId'; 6 | export * from './resizer'; 7 | export * from './checkIsSizableImageURL'; 8 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Adaptive/types.ts: -------------------------------------------------------------------------------- 1 | export type AdaptiveVisitorClaimsData = Record & { 2 | unsigned: Record; 3 | }; 4 | 5 | export type AdaptiveVisitorClaims = { 6 | visitor: { 7 | claims: AdaptiveVisitorClaimsData; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /packages/react-math/css/default.css: -------------------------------------------------------------------------------- 1 | /** Hide the KaTeX HTML output, while it's loading */ 2 | body:not(.katex-loaded) .katex-html { 3 | display: none; 4 | } 5 | 6 | /** Align the MathJax output with the font-size used by KaTeX */ 7 | mjx-container[jax="CHTML"] { 8 | font-size: 1.21em; 9 | } 10 | -------------------------------------------------------------------------------- /.github/composite/setup-bun/action.yaml: -------------------------------------------------------------------------------- 1 | name: 'Setup Bun' 2 | description: 'Install Bun and cache dependencies' 3 | runs: 4 | using: 'composite' 5 | steps: 6 | - name: Setup bun 7 | uses: oven-sh/setup-bun@v2 8 | with: 9 | bun-version-file: 'package.json' 10 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/utils/isAIChatEnabled.ts: -------------------------------------------------------------------------------- 1 | import type { GitBookSiteContext } from '@/lib/context'; 2 | import { CustomizationAIMode } from '@gitbook/api'; 3 | 4 | export const isAIChatEnabled = (context: GitBookSiteContext) => 5 | context.customization.ai.mode === CustomizationAIMode.Assistant; 6 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/images/resizer/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copy a response to make sure it can be mutated by the rest of the middleware. 3 | * To avoid errors "Can't modify immutable headers". 4 | */ 5 | export function copyImageResponse(response: Response) { 6 | return new Response(response.body, response); 7 | } 8 | -------------------------------------------------------------------------------- /packages/gitbook/public/_headers: -------------------------------------------------------------------------------- 1 | # GitBook immutable static assets 2 | # Duplicated from next.config.mjs until OpenNext supports generating static headers 3 | /~gitbook/static/* 4 | cache-control: public,max-age=31536000,immutable 5 | Access-Control-Allow-Origin: * 6 | /_next/static/* 7 | Access-Control-Allow-Origin: * 8 | -------------------------------------------------------------------------------- /packages/embed/tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsdown'; 2 | 3 | export default defineConfig([ 4 | { 5 | entry: 'src/index.ts', 6 | outDir: 'dist', 7 | }, 8 | { 9 | entry: 'src/react/index.ts', 10 | outDir: 'dist/react', 11 | unbundle: true, 12 | }, 13 | ]); 14 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/tailwind.ts: -------------------------------------------------------------------------------- 1 | import { type ClassNameValue, twMerge } from 'tailwind-merge'; 2 | 3 | export type { ClassNameValue as ClassValue }; 4 | 5 | /** 6 | * Create a tailwind className for a component. 7 | */ 8 | export function tcls(...values: ClassNameValue[]): string { 9 | return twMerge(...values); 10 | } 11 | -------------------------------------------------------------------------------- /packages/gitbook/scripts/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o pipefail 5 | 6 | # Copy the assets 7 | gitbook-icons ./public/~gitbook/static/icons custom-icons 8 | gitbook-math ./public/~gitbook/static/math 9 | cp -r ../embed/standalone/ ./public/~gitbook/static/embed 10 | 11 | # Generate the types 12 | wrangler types 13 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "public", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Insights/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Generate a random ID. 3 | */ 4 | export function generateRandomId(): string { 5 | if (typeof crypto !== 'undefined' && crypto.randomUUID) { 6 | return `${crypto.randomUUID()}R`; 7 | } 8 | 9 | // Fallback for old browsers 10 | return `${Math.random().toString(36).substring(2)}R`; 11 | } 12 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/hooks/useIsMounted.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | /** 4 | * Hook to check if a component is mounted. 5 | */ 6 | export function useIsMounted() { 7 | const [mounted, setMounted] = React.useState(false); 8 | 9 | React.useEffect(() => { 10 | setMounted(true); 11 | }, []); 12 | 13 | return mounted; 14 | } 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Something not working as expected? Let us look into it 4 | labels: bug 5 | --- 6 | 7 | ## Bug description 8 | 9 | _Please describe._ 10 | _If this affects the front-end, screenshots would be of great help._ 11 | 12 | ## How to reproduce 13 | 14 | 1. 15 | 2. 16 | 3. 17 | 18 | ## Additional context 19 | -------------------------------------------------------------------------------- /packages/openapi-parser/src/helpers/shouldIgnoreEntity.ts: -------------------------------------------------------------------------------- 1 | import type { OpenAPIV3 } from '@scalar/openapi-types'; 2 | 3 | /** 4 | * Check if an entity should be ignored 5 | */ 6 | export function shouldIgnoreEntity( 7 | data: undefined | OpenAPIV3.TagObject | OpenAPIV3.OperationObject 8 | ) { 9 | return data?.['x-internal'] === true || data?.['x-gitbook-ignore'] === true; 10 | } 11 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/hooks/usePrevious.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | /** 4 | * Returns the value of the previous render. 5 | */ 6 | export function usePrevious(value: T): T | undefined { 7 | const ref = React.useRef(undefined); 8 | React.useLayoutEffect(() => { 9 | ref.current = value; 10 | }); 11 | return ref.current; 12 | } 13 | -------------------------------------------------------------------------------- /packages/react-openapi/src/Markdown.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'classnames'; 2 | 3 | export function Markdown(props: { source: string; className?: string }) { 4 | const { source, className } = props; 5 | 6 | return ( 7 |
11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/utils/ZoomImage.module.css: -------------------------------------------------------------------------------- 1 | html:has(.zoomModal) { 2 | overflow: hidden; 3 | } 4 | 5 | .zoomImg { 6 | cursor: zoom-in; 7 | } 8 | 9 | .zoomImageActive { 10 | view-transition-name: zoom-image; 11 | } 12 | 13 | .zoomModal { 14 | /** Unstyled */ 15 | } 16 | 17 | .zoomModal img { 18 | view-transition-name: zoom-image; 19 | cursor: zoom-out; 20 | } 21 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Emoji.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentInlineEmoji } from '@gitbook/api'; 2 | 3 | import { Emoji as EmojiPrimitive } from '@/components/primitives'; 4 | 5 | import type { InlineProps } from './Inline'; 6 | 7 | export function Emoji(props: InlineProps) { 8 | const { inline } = props; 9 | 10 | return ; 11 | } 12 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/assets.ts: -------------------------------------------------------------------------------- 1 | import { GITBOOK_ASSETS_URL, GITBOOK_URL } from '@/lib/env'; 2 | import { joinPath, joinPathWithBaseURL } from './paths'; 3 | 4 | /** 5 | * Create a public URL for an asset. 6 | */ 7 | export function getAssetURL(path: string): string { 8 | return joinPathWithBaseURL( 9 | GITBOOK_ASSETS_URL || GITBOOK_URL, 10 | joinPath('~gitbook/static', path) 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /packages/react-contentkit/src/ElementBlock.tsx: -------------------------------------------------------------------------------- 1 | import type { ContentKitBlock } from '@gitbook/api'; 2 | import type React from 'react'; 3 | 4 | import type { ContentKitServerElementProps } from './types'; 5 | 6 | export function ElementBlock( 7 | props: React.PropsWithChildren> 8 | ) { 9 | const { children } = props; 10 | 11 | return <>{children}; 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Divider.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentBlockDivider } from '@gitbook/api'; 2 | 3 | import { tcls } from '@/lib/tailwind'; 4 | 5 | import type { BlockProps } from './Block'; 6 | 7 | export function Divider(props: BlockProps) { 8 | const { style } = props; 9 | 10 | return
; 11 | } 12 | -------------------------------------------------------------------------------- /packages/gitbook/types/memoizee.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'memoizee' { 2 | declare function memoizee any>( 3 | f: F, 4 | options?: { normalizer?: (args: any[]) => string } 5 | ): F; 6 | 7 | export = memoizee; 8 | } 9 | 10 | declare module 'memoizee/weak' { 11 | declare function memoizee any>(f: F): F; 12 | 13 | export = memoizee; 14 | } 15 | -------------------------------------------------------------------------------- /packages/openapi-parser/src/index.ts: -------------------------------------------------------------------------------- 1 | export { parseOpenAPI } from './parse'; 2 | 3 | export { dereference, isJson, isYaml } from '@scalar/openapi-parser'; 4 | export type { AnyObject } from '@scalar/openapi-parser'; 5 | export type * from '@scalar/openapi-types'; 6 | export * from './error'; 7 | export * from './helpers/shouldIgnoreEntity'; 8 | export * from './traverse'; 9 | export * from './schemas'; 10 | export type * from './types'; 11 | -------------------------------------------------------------------------------- /packages/openapi-parser/src/fixtures/remote-ref/tag.yaml: -------------------------------------------------------------------------------- 1 | components: 2 | schemas: 3 | Tag: 4 | x-swagger-router-model: io.swagger.petstore.model.Tag 5 | properties: 6 | id: 7 | type: integer 8 | format: int64 9 | name: 10 | type: string 11 | xml: 12 | name: tag 13 | type: object 14 | -------------------------------------------------------------------------------- /packages/react-contentkit/src/ElementImage.tsx: -------------------------------------------------------------------------------- 1 | import type { ContentKitImage } from '@gitbook/api'; 2 | 3 | import type { ContentKitServerElementProps } from './types'; 4 | 5 | export function ElementImage(props: ContentKitServerElementProps) { 6 | const { element } = props; 7 | 8 | // TODO: do block display with aspect ratio 9 | 10 | return ; 11 | } 12 | -------------------------------------------------------------------------------- /packages/react-openapi/src/__snapshots__/json2xml.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Bun Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`getUrlFromServerState indents correctly 1`] = ` 4 | " 5 | 10 6 | doggie 7 | 8 | 1 9 | Dogs 10 | 11 | string 12 | 13 | 0 14 | string 15 | 16 | available 17 | " 18 | `; 19 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export * from './useScrollActiveId'; 2 | export * from './useScrollPage'; 3 | export * from './useHash'; 4 | export * from './useIsMounted'; 5 | export * from './useToggleAnimation'; 6 | export * from './useCurrentPagePath'; 7 | export * from './useCurrentContent'; 8 | export * from './useCurrentPage'; 9 | export * from './useNow'; 10 | export * from './useListOverflow'; 11 | export * from './useCurrentPageMetadata'; 12 | -------------------------------------------------------------------------------- /packages/react-contentkit/src/ElementBox.tsx: -------------------------------------------------------------------------------- 1 | import type { ContentKitBox } from '@gitbook/api'; 2 | import type React from 'react'; 3 | 4 | import type { ContentKitServerElementProps } from './types'; 5 | 6 | export function ElementBox( 7 | props: React.PropsWithChildren> 8 | ) { 9 | const { element, children } = props; 10 | 11 | return
{children}
; 12 | } 13 | -------------------------------------------------------------------------------- /patches/decode-named-character-reference@1.0.2.patch: -------------------------------------------------------------------------------- 1 | diff --git a/package.json b/package.json 2 | index 5fef2811aa86f3f1f8228daef7d867863e71db72..7d4f6b5f3824f87dda262a28970bc91d6b37fd13 100644 3 | --- a/package.json 4 | +++ b/package.json 5 | @@ -34,7 +34,6 @@ 6 | "deno": "./index.js", 7 | "react-native": "./index.js", 8 | "worker": "./index.js", 9 | - "browser": "./index.dom.js", 10 | "default": "./index.js" 11 | } 12 | }, 13 | -------------------------------------------------------------------------------- /packages/emoji-codepoints/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @gitbook/emoji-codepoints 2 | 3 | ## 0.2.2 4 | 5 | ### Patch Changes 6 | 7 | - 6142d6b: Mark as sideEffects, fix all package bundles 8 | 9 | ## 0.2.1 10 | 11 | ### Patch Changes 12 | 13 | - 295f03d: Republish packages 14 | 15 | ## 0.2.0 16 | 17 | ### Minor Changes 18 | 19 | - 57adb3e: Second release to fix publishing with changeset 20 | 21 | ## 0.1.0 22 | 23 | ### Minor Changes 24 | 25 | - 5f8a8fe: Initial release 26 | -------------------------------------------------------------------------------- /packages/fonts/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @gitbook/fonts 2 | 3 | ## 0.1.3 4 | 5 | ### Patch Changes 6 | 7 | - 10995e0: Use NPM Trusted publishing for publishing the package. 8 | 9 | ## 0.1.2 10 | 11 | ### Patch Changes 12 | 13 | - 6142d6b: Mark as sideEffects, fix all package bundles 14 | 15 | ## 0.1.1 16 | 17 | ### Patch Changes 18 | 19 | - 295f03d: Republish packages 20 | 21 | ## 0.1.0 22 | 23 | ### Minor Changes 24 | 25 | - fbfcca5: Initial version of the package 26 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/global-error.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import NextError from 'next/error'; 4 | 5 | export default function GlobalError({ 6 | error, 7 | }: { 8 | error: Error & { digest?: string }; 9 | }) { 10 | console.error('Global error:', error); 11 | return ( 12 | 13 | 14 | 15 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/data/cloudflare.ts: -------------------------------------------------------------------------------- 1 | import { getCloudflareContext as getCloudflareContextOpenNext } from '@opennextjs/cloudflare'; 2 | import { GITBOOK_RUNTIME } from '../env'; 3 | 4 | /** 5 | * Return the Cloudflare context or null when not running in Cloudflare. 6 | */ 7 | export function getCloudflareContext() { 8 | if (GITBOOK_RUNTIME !== 'cloudflare') { 9 | return null; 10 | } 11 | 12 | return getCloudflareContextOpenNext(); 13 | } 14 | -------------------------------------------------------------------------------- /packages/gitbook/openNext/queue/middleware.ts: -------------------------------------------------------------------------------- 1 | import type { Queue } from '@opennextjs/aws/types/overrides.js'; 2 | import { getCloudflareContext } from '@opennextjs/cloudflare'; 3 | import doQueue from '@opennextjs/cloudflare/overrides/queue/do-queue'; 4 | 5 | export default { 6 | name: 'GitbookISRQueue', 7 | send: async (msg) => { 8 | const { ctx } = getCloudflareContext(); 9 | ctx.waitUntil(doQueue.send(msg)); 10 | }, 11 | } satisfies Queue; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # misc 9 | .DS_Store 10 | *.pem 11 | 12 | # debug 13 | npm-debug.log* 14 | yarn-debug.log* 15 | yarn-error.log* 16 | 17 | # Turbo 18 | .turbo 19 | 20 | # Vercel 21 | .vercel 22 | 23 | # Env files 24 | .env.local 25 | 26 | # TypeScript 27 | *.tsbuildinfo 28 | .npmrc 29 | 30 | # Bun pack artifacts 31 | packages/*/*.tgz 32 | -------------------------------------------------------------------------------- /packages/react-contentkit/src/ElementIcon.tsx: -------------------------------------------------------------------------------- 1 | import type { ContentKitIcon } from '@gitbook/api'; 2 | import type { ContentKitServerContext } from './types'; 3 | 4 | export function ElementIcon(props: { icon: ContentKitIcon; context: ContentKitServerContext }) { 5 | const { icon, context } = props; 6 | const C = context.icons[icon]; 7 | if (!C) { 8 | return ; 9 | } 10 | 11 | return ; 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Announcement/constants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * The local storage key for the announcement banner. 3 | */ 4 | export const ANNOUNCEMENT_STORAGE_KEY = '@gitbook/announcement'; 5 | /** 6 | * The CSS class to hide the announcement banner. Applies to the element. 7 | */ 8 | export const ANNOUNCEMENT_CSS_CLASS = 'announcement-hidden'; 9 | /** 10 | * The number of days until the announcement banner resets. 11 | */ 12 | export const ANNOUNCEMENT_DAYS_TILL_RESET = 7; 13 | -------------------------------------------------------------------------------- /packages/emoji-codepoints/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gitbook/emoji-codepoints", 3 | "description": "Optimized mapping of codepoints to the fully qualified emoji codepoints", 4 | "version": "0.2.2", 5 | "private": true, 6 | "exports": "./dist/index.ts", 7 | "sideEffects": false, 8 | "devDependencies": { 9 | "emoji-assets": "^9.0.0" 10 | }, 11 | "scripts": { 12 | "generate": "bun ./build.ts", 13 | "clean": "rm -rf ./dist" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Embeddable/EmbeddableAssistantPage.tsx: -------------------------------------------------------------------------------- 1 | import { EmbeddableAIChat } from './EmbeddableAIChat'; 2 | 3 | type EmbeddableAssistantPageProps = { 4 | baseURL: string; 5 | siteTitle: string; 6 | }; 7 | 8 | /** 9 | * Reusable page component for the embed assistant page. 10 | */ 11 | export async function EmbeddableAssistantPage(props: EmbeddableAssistantPageProps) { 12 | return ; 13 | } 14 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/images/utils.ts: -------------------------------------------------------------------------------- 1 | import type { ImageResizer, ResizeImageOptions } from './types'; 2 | 3 | /** 4 | * Quick utility to get a resized image URL. 5 | */ 6 | export async function getResizedImageURL( 7 | resizer: ImageResizer | undefined, 8 | url: string, 9 | options: ResizeImageOptions 10 | ) { 11 | const getURL = resizer?.getResizedImageURL(url); 12 | if (!getURL) { 13 | return url; 14 | } 15 | 16 | return await getURL(options); 17 | } 18 | -------------------------------------------------------------------------------- /packages/fonts/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { CustomizationDefaultFont } from '@gitbook/api'; 2 | 3 | export type FontWeight = 400 | 700; 4 | 5 | export type FontDefinition = { 6 | font: string; 7 | unicodeRange: { 8 | [script: string]: string; 9 | }; 10 | variants: { 11 | [weight in string]: { 12 | [script: string]: string; 13 | }; 14 | }; 15 | }; 16 | 17 | export type FontDefinitions = { [fontName in CustomizationDefaultFont]: FontDefinition }; 18 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/browser/security-error.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Test if the error is a security error returned by the browser when cookies or local storage are blocked. 3 | */ 4 | export function checkIsSecurityError(error: unknown): error is Error { 5 | return ( 6 | error instanceof Error && 7 | // Safari 8 | (error.name === 'SecurityError' || 9 | // Firefox 10 | error.name === 'NS_ERROR_FAILURE' || 11 | error.name === 'NS_ERROR_ABORT') 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/icon/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getDynamicSiteContext } from '@/app/utils'; 4 | import { serveIcon } from '@/routes/icon'; 5 | 6 | export async function GET( 7 | request: NextRequest, 8 | { params }: { params: Promise } 9 | ) { 10 | const { context } = await getDynamicSiteContext(await params); 11 | return serveIcon(context, request); 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/preview.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Check if the request to the site is a preview request. 3 | */ 4 | export function isPreviewRequest(requestURL: URL): boolean { 5 | return requestURL.host === 'preview'; 6 | } 7 | 8 | export function getPreviewRequestIdentifier(requestURL: URL): string { 9 | // For preview requests, we extract the site ID from the pathname 10 | // e.g. https://preview/site_id/... 11 | const pathname = requestURL.pathname.slice(1).split('/'); 12 | return pathname[0]!; 13 | } 14 | -------------------------------------------------------------------------------- /packages/react-openapi/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './schemas'; 2 | export * from './OpenAPIOperation'; 3 | export * from './OpenAPIWebhook'; 4 | export * from './OpenAPIOperationContext'; 5 | export * from './OpenAPIPrefillContextProvider'; 6 | export * from './resolveOpenAPIOperation'; 7 | export * from './resolveOpenAPIWebhook'; 8 | export type { OpenAPIOperationData, OpenAPIWebhookData } from './types'; 9 | export type { OpenAPIContextInput } from './context'; 10 | export { checkIsValidLocale } from './translations'; 11 | -------------------------------------------------------------------------------- /packages/gitbook/openNext/queue/server.ts: -------------------------------------------------------------------------------- 1 | import { getLogger } from '@/lib/logger'; 2 | import type { Queue } from '@opennextjs/aws/types/overrides.js'; 3 | 4 | export default { 5 | name: 'GitbookISRQueue', 6 | send: async (msg) => { 7 | const logger = getLogger().subLogger('GitbookISRQueue'); 8 | // We should never reach this point in the server. If that's the case, we should log it. 9 | logger.warn('send called on server side, this should not happen.', msg); 10 | }, 11 | } satisfies Queue; 12 | -------------------------------------------------------------------------------- /packages/react-math/src/MathJaXLazy.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import React from 'react'; 4 | import type { MathJaXFormulaProps } from './MathJaX'; 5 | 6 | const MathJaXFormula = React.lazy(() => import('./MathJaX')); 7 | 8 | /** 9 | * Lazy component that loads MathJax and renders the formula. 10 | */ 11 | export function MathJaXLazy(props: MathJaXFormulaProps) { 12 | return ( 13 | 14 | 15 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/~space/[spaceId]/~gitbook/pdf/layout.tsx: -------------------------------------------------------------------------------- 1 | import { type SpacePDFRouteParams, getSpacePDFContext } from '@/app/~space/[spaceId]/pdf'; 2 | import { PDFRootLayout } from '@/components/PDF'; 3 | 4 | export default async function RootLayout(props: { 5 | params: Promise; 6 | children: React.ReactNode; 7 | }) { 8 | const { params, children } = props; 9 | const context = await getSpacePDFContext(await params); 10 | 11 | return {children}; 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/primitives/Emoji/Emoji.tsx: -------------------------------------------------------------------------------- 1 | import { getEmojiForCode } from '@/lib/emojis'; 2 | import { type ClassValue, tcls } from '@/lib/tailwind'; 3 | 4 | /** 5 | * Render an emoji by its codepoint. 6 | * It renders the UTF-8 character and use Emoji font defined in Tailwind CSS. 7 | */ 8 | export function Emoji(props: { code: string; style?: ClassValue }) { 9 | const { code, style } = props; 10 | 11 | const fallback = getEmojiForCode(code); 12 | return {fallback}; 13 | } 14 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/pdf/layout.tsx: -------------------------------------------------------------------------------- 1 | import { type RouteLayoutParams, getDynamicSiteContext } from '@/app/utils'; 2 | import { PDFRootLayout } from '@/components/PDF'; 3 | 4 | export default async function RootLayout(props: { 5 | params: Promise; 6 | children: React.ReactNode; 7 | }) { 8 | const { params, children } = props; 9 | const { context } = await getDynamicSiteContext(await params); 10 | 11 | return {children}; 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/icon/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import { serveIcon } from '@/routes/icon'; 5 | 6 | export const dynamic = 'force-static'; 7 | 8 | export async function GET( 9 | request: NextRequest, 10 | { params }: { params: Promise } 11 | ) { 12 | const { context } = await getStaticSiteContext(await params); 13 | return serveIcon(context, request); 14 | } 15 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/primitives/index.ts: -------------------------------------------------------------------------------- 1 | export * from './Checkbox'; 2 | export * from './Button'; 3 | export * from './Loading'; 4 | export * from './Card'; 5 | export * from './Skeleton'; 6 | export * from './Link'; 7 | export * from './StyledLink'; 8 | export * from './DateRelative'; 9 | export * from './Emoji'; 10 | export * from './LoadingPane'; 11 | export * from './Tooltip'; 12 | export * from './Popover'; 13 | export * from './LoadingStateProvider'; 14 | export * from './HoverCard'; 15 | export * from './DropdownMenu'; 16 | export * from './Input'; 17 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/robots.txt/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import { serveRobotsTxt } from '@/routes/robots'; 5 | 6 | export const dynamic = 'force-static'; 7 | 8 | export async function GET( 9 | _request: NextRequest, 10 | { params }: { params: Promise } 11 | ) { 12 | const { context } = await getStaticSiteContext(await params); 13 | return serveRobotsTxt(context); 14 | } 15 | -------------------------------------------------------------------------------- /patches/@vercel%2Fnext@4.4.2.patch: -------------------------------------------------------------------------------- 1 | diff --git a/dist/index.js b/dist/index.js 2 | index 74c72085defa714ebfbeaf7c63b7956f6848da82..0d056888100804bc5442cf7378652b6886ecd357 100644 3 | --- a/dist/index.js 4 | +++ b/dist/index.js 5 | @@ -10473,7 +10473,7 @@ var import_path = require("path"); 6 | // src/constants.ts 7 | var KIB = 1024; 8 | var MIB = 1024 * KIB; 9 | -var EDGE_FUNCTION_SIZE_LIMIT = 4 * MIB; 10 | +var EDGE_FUNCTION_SIZE_LIMIT = 10 * MIB; 11 | var DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE = 250 * MIB; 12 | var LAMBDA_RESERVED_UNCOMPRESSED_SIZE = 25 * MIB; 13 | 14 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/sitemap.xml/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import { serveRootSitemap } from '@/routes/sitemap'; 5 | 6 | export const dynamic = 'force-static'; 7 | 8 | export async function GET( 9 | _request: NextRequest, 10 | { params }: { params: Promise } 11 | ) { 12 | const { context } = await getStaticSiteContext(await params); 13 | return serveRootSitemap(context); 14 | } 15 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/llms-full.txt/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import { serveLLMsFullTxt } from '@/routes/llms-full'; 5 | 6 | export const dynamic = 'force-static'; 7 | 8 | export async function GET( 9 | _request: NextRequest, 10 | { params }: { params: Promise } 11 | ) { 12 | const { context } = await getStaticSiteContext(await params); 13 | return serveLLMsFullTxt(context); 14 | } 15 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/sitemap-pages.xml/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import { servePagesSitemap } from '@/routes/sitemap'; 5 | 6 | export const dynamic = 'force-static'; 7 | 8 | export async function GET( 9 | _request: NextRequest, 10 | { params }: { params: Promise } 11 | ) { 12 | const { context } = await getStaticSiteContext(await params); 13 | return servePagesSitemap(context); 14 | } 15 | -------------------------------------------------------------------------------- /packages/gitbook/types/images.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.svg' { 2 | const value: { 3 | src: string; 4 | width: number; 5 | height: number; 6 | }; 7 | export default value; 8 | } 9 | 10 | declare module '*.png' { 11 | const value: { 12 | src: string; 13 | width: number; 14 | height: number; 15 | }; 16 | export default value; 17 | } 18 | 19 | declare module '*.jpg' { 20 | const value: { 21 | src: string; 22 | width: number; 23 | height: number; 24 | }; 25 | export default value; 26 | } 27 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/llms.txt/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import { serveLLMsTxt } from '@/routes/llms'; 5 | 6 | export const dynamic = 'force-static'; 7 | 8 | export async function GET( 9 | _request: NextRequest, 10 | { params }: { params: Promise } 11 | ) { 12 | const { context } = await getStaticSiteContext(await params); 13 | return serveLLMsTxt(context, { withMarkdownPages: true }); 14 | } 15 | -------------------------------------------------------------------------------- /packages/icons/src/pro.test.ts: -------------------------------------------------------------------------------- 1 | import { it } from 'bun:test'; 2 | import { validateIconName } from './icons'; 3 | 4 | it('should have the GitBook custom icon', () => { 5 | if (!validateIconName('gitbook')) { 6 | const message = 7 | 'The GitBook icon is missing. It indicates that the dependencies were installed without the correct font-awesome package. These changes have probably been persisted in the Bun lockfile. Read the README for more information.'; 8 | 9 | if (process.env.CI) { 10 | throw new Error(message); 11 | } 12 | } 13 | }); 14 | -------------------------------------------------------------------------------- /packages/react-contentkit/src/ElementDivider.tsx: -------------------------------------------------------------------------------- 1 | import type { ContentKitDivider } from '@gitbook/api'; 2 | 3 | import classNames from 'classnames'; 4 | import type { ContentKitServerElementProps } from './types'; 5 | 6 | export function ElementDivider(props: ContentKitServerElementProps) { 7 | const { element } = props; 8 | 9 | return ( 10 |
16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Stepper.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentBlockStepper } from '@gitbook/api'; 2 | 3 | import type { BlockProps } from './Block'; 4 | import { Blocks } from './Blocks'; 5 | 6 | export function Stepper(props: BlockProps) { 7 | const { block, style, ancestorBlocks, ...contextProps } = props; 8 | 9 | return ( 10 | 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/gitbook/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["//"], 3 | "tasks": { 4 | "generate": { 5 | "outputs": [ 6 | "public/~gitbook/static/icons/**/*", 7 | "public/~gitbook/static/math/**/*", 8 | "public/~gitbook/static/embed/**/*" 9 | ], 10 | "dependsOn": ["^generate", "@gitbook/embed#build"] 11 | }, 12 | "typecheck": { 13 | "dependsOn": ["^typecheck", "generate"] 14 | }, 15 | "publish-to-npm": { 16 | "dependsOn": [] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Updates.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentBlockUpdates } from '@gitbook/api'; 2 | import type { BlockProps } from './Block'; 3 | import { Blocks } from './Blocks'; 4 | 5 | export function Updates(props: BlockProps) { 6 | const { block, style, ancestorBlocks, ...contextProps } = props; 7 | 8 | return ( 9 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/PDF/PrintButton.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import * as React from 'react'; 4 | 5 | import type { PolymorphicComponentProp } from '@/components/utils/types'; 6 | 7 | export function PrintButton(props: PolymorphicComponentProp<'button'>) { 8 | const { className, children, ...rest } = props; 9 | 10 | const onClick = React.useCallback(() => { 11 | window.print(); 12 | }, []); 13 | 14 | return ( 15 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/emojis.ts: -------------------------------------------------------------------------------- 1 | import { emojiCodepoints } from '@gitbook/emoji-codepoints'; 2 | 3 | /** 4 | * Returns the emoji character for the given emoji code. 5 | */ 6 | export function getEmojiForCode(code: string): string { 7 | if (!code) { 8 | return ''; 9 | } 10 | 11 | code = code.toLowerCase(); 12 | const fullCode = emojiCodepoints[code] ?? code; 13 | 14 | const codePoints = fullCode.split('-').map((elt) => Number.parseInt(elt, 16)); 15 | 16 | try { 17 | return String.fromCodePoint(...codePoints); 18 | } catch { 19 | return ''; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/gitbook/openNext/incrementalCache/middleware.ts: -------------------------------------------------------------------------------- 1 | import { withRegionalCache } from '@opennextjs/cloudflare/overrides/incremental-cache/regional-cache'; 2 | import { GitbookIncrementalCache } from './incrementalCache'; 3 | 4 | export default withRegionalCache(new GitbookIncrementalCache(), { 5 | mode: 'long-lived', 6 | // We can do it because we use our own logic to invalidate the cache 7 | bypassTagCacheOnCacheHit: true, 8 | defaultLongLivedTtlSec: 60 * 60 * 24 /* 24 hours */, 9 | // We don't want to update the cache entry on every cache hit 10 | shouldLazilyUpdateOnCacheHit: false, 11 | }); 12 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/dynamic/[mode]/[siteURL]/[siteData]/~gitbook/ogimage/[pageId]/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getDynamicSiteContext } from '@/app/utils'; 4 | import type { PageIdParams } from '@/components/SitePage'; 5 | import { serveOGImage } from '@/routes/ogimage'; 6 | 7 | export async function GET( 8 | _request: NextRequest, 9 | { params }: { params: Promise } 10 | ) { 11 | const { context } = await getDynamicSiteContext(await params); 12 | return serveOGImage(context, await params); 13 | } 14 | -------------------------------------------------------------------------------- /packages/gitbook/src/intl/client.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import type { TranslationLanguage } from './translations'; 4 | 5 | export * from './translate'; 6 | 7 | export const TranslateContext = React.createContext(null); 8 | 9 | /** 10 | * Use the current language to translate a string. 11 | */ 12 | export function useLanguage(): TranslationLanguage { 13 | const language = React.useContext(TranslateContext); 14 | if (!language) { 15 | throw new Error('The hook useLanguage should be wrapped in a '); 16 | } 17 | return language; 18 | } 19 | -------------------------------------------------------------------------------- /packages/openapi-parser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": ["@tsconfig/strictest/tsconfig.json", "@tsconfig/node20/tsconfig.json"], 4 | "compilerOptions": { 5 | "lib": ["ESNext", "DOM"], 6 | "module": "ESNext", 7 | "moduleResolution": "bundler", 8 | "isolatedModules": true, 9 | "incremental": true, 10 | "noEmit": true, 11 | "noPropertyAccessFromIndexSignature": false, 12 | "types": [ 13 | "bun-types" // add Bun global 14 | ] 15 | }, 16 | "include": ["src/**/*.ts"] 17 | } 18 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/rss/[pagePath]/route.ts: -------------------------------------------------------------------------------- 1 | import { type RouteParams, getPagePathFromParams, getStaticSiteContext } from '@/app/utils'; 2 | import { servePageRSS } from '@/routes/rss'; 3 | import type { NextRequest } from 'next/server'; 4 | 5 | export const dynamic = 'force-static'; 6 | 7 | export async function GET(_request: NextRequest, { params }: { params: Promise }) { 8 | const { context } = await getStaticSiteContext(await params); 9 | const pathname = getPagePathFromParams(await params); 10 | 11 | return servePageRSS(context, pathname); 12 | } 13 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/paths.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from 'bun:test'; 2 | import { getExtension } from './paths'; 3 | 4 | describe('getExtension', () => { 5 | it('should return the extension of a path', () => { 6 | expect(getExtension('test.txt')).toBe('.txt'); 7 | }); 8 | 9 | it('should return an empty string if there is no extension', () => { 10 | expect(getExtension('test/path/to/file')).toBe(''); 11 | }); 12 | 13 | it('should return the extension of a path with multiple dots', () => { 14 | expect(getExtension('test.with.multiple.dots.txt')).toBe('.txt'); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/markdown/[pagePath]/route.ts: -------------------------------------------------------------------------------- 1 | import { type RouteParams, getPagePathFromParams, getStaticSiteContext } from '@/app/utils'; 2 | import { servePageMarkdown } from '@/routes/markdownPage'; 3 | import type { NextRequest } from 'next/server'; 4 | 5 | export const dynamic = 'force-static'; 6 | 7 | export async function GET(_request: NextRequest, { params }: { params: Promise }) { 8 | const { context } = await getStaticSiteContext(await params); 9 | const pathname = getPagePathFromParams(await params); 10 | return servePageMarkdown(context, pathname); 11 | } 12 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/arrays.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Partition an array into equal (+ rest items) parts. 3 | * Adapted from https://stackoverflow.com/a/68917937 4 | */ 5 | export function partition( 6 | /** 7 | * Array to split up 8 | */ 9 | array: any[], 10 | /** 11 | * Amount of parts you want to split into 12 | */ 13 | parts: number 14 | ) { 15 | const rest = array.length % parts; 16 | const size = Math.floor(array.length / parts); 17 | let j = 0; 18 | 19 | return Array.from({ length: Math.min(array.length, parts) }, (_, i) => 20 | array.slice(j, (j += size + (i < rest ? 1 : 0))) 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /packages/icons/bin/kit.js: -------------------------------------------------------------------------------- 1 | import path from 'node:path'; 2 | import url from 'node:url'; 3 | 4 | /** 5 | * Get the path to the kit, depending on the Pro or Free version. 6 | */ 7 | export function getKitPath() { 8 | let source = path.dirname( 9 | url.fileURLToPath(import.meta.resolve('@fortawesome/fontawesome-free/package.json')) 10 | ); 11 | try { 12 | source = path.resolve( 13 | path.dirname( 14 | url.fileURLToPath(import.meta.resolve('@gitbook/fontawesome-pro/package.json')) 15 | ), 16 | 'icons' 17 | ); 18 | } catch (_error) {} 19 | 20 | return source; 21 | } 22 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Paragraph.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentBlockParagraph } from '@gitbook/api'; 2 | 3 | import { tcls } from '@/lib/tailwind'; 4 | 5 | import type { BlockProps } from './Block'; 6 | import { Inlines } from './Inlines'; 7 | import { getTextAlignment } from './utils'; 8 | 9 | export function Paragraph(props: BlockProps) { 10 | const { block, style, ...contextProps } = props; 11 | 12 | return ( 13 |

14 | 15 |

16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /packages/gitbook/src/app/sites/static/[mode]/[siteURL]/[siteData]/~gitbook/ogimage/[pageId]/route.ts: -------------------------------------------------------------------------------- 1 | import type { NextRequest } from 'next/server'; 2 | 3 | import { type RouteLayoutParams, getStaticSiteContext } from '@/app/utils'; 4 | import type { PageIdParams } from '@/components/SitePage'; 5 | import { serveOGImage } from '@/routes/ogimage'; 6 | 7 | export const dynamic = 'force-static'; 8 | 9 | export async function GET( 10 | _request: NextRequest, 11 | { params }: { params: Promise } 12 | ) { 13 | const { context } = await getStaticSiteContext(await params); 14 | return serveOGImage(context, await params); 15 | } 16 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/hooks/useCurrentPagePath.ts: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { useParams } from 'next/navigation'; 4 | 5 | import { removeLeadingSlash } from '@/lib/paths'; 6 | import { useMemo } from 'react'; 7 | 8 | /** 9 | * Return the page of the current page being rendered. 10 | */ 11 | export function useCurrentPagePath() { 12 | const params = useParams<{ pagePath?: string }>(); 13 | 14 | return useMemo(() => { 15 | if (params?.pagePath && typeof params.pagePath === 'string') { 16 | return removeLeadingSlash(decodeURIComponent(params.pagePath)); 17 | } 18 | 19 | return ''; 20 | }, [params?.pagePath]); 21 | } 22 | -------------------------------------------------------------------------------- /packages/expr/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": ["@tsconfig/strictest/tsconfig.json", "@tsconfig/node20/tsconfig.json"], 4 | "compilerOptions": { 5 | "lib": ["ESNext", "DOM"], 6 | "module": "ESNext", 7 | "moduleResolution": "bundler", 8 | "isolatedModules": true, 9 | "incremental": true, 10 | "noEmit": true, 11 | "noPropertyAccessFromIndexSignature": false, 12 | "exactOptionalPropertyTypes": false, 13 | "types": [ 14 | "bun-types" // add Bun global 15 | ] 16 | }, 17 | "include": ["types/**/*.d.ts", "src/**/*.ts"] 18 | } 19 | -------------------------------------------------------------------------------- /packages/gitbook/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 3 | 4 | # testing 5 | /coverage 6 | 7 | # next.js 8 | /.next/ 9 | /out/ 10 | 11 | # production 12 | /build 13 | 14 | # local env files 15 | .env*.local 16 | 17 | # vercel 18 | .vercel 19 | 20 | # typescript 21 | *.tsbuildinfo 22 | next-env.d.ts 23 | 24 | # visual tests 25 | screenshots/ 26 | 27 | /test-results/ 28 | /playwright-report/ 29 | /blob-report/ 30 | /playwright/.cache/ 31 | 32 | # Generated public files 33 | /public/~gitbook/static/* 34 | !/public/~gitbook/static/images 35 | 36 | # cloudflare 37 | .open-next 38 | .wrangler 39 | worker-configuration.d.ts -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/Quote.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentBlockQuote } from '@gitbook/api'; 2 | 3 | import type { BlockProps } from './Block'; 4 | import { Blocks } from './Blocks'; 5 | 6 | export function Quote(props: BlockProps) { 7 | const { block, style, ancestorBlocks, ...contextProps } = props; 8 | 9 | return ( 10 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /packages/gitbook/src/lib/images/getImageResizingContextId.ts: -------------------------------------------------------------------------------- 1 | import { getPreviewRequestIdentifier, isPreviewRequest } from '@/lib/preview'; 2 | import { getProxyRequestIdentifier, isProxyRequest } from '@/lib/proxy'; 3 | 4 | /** 5 | * Get the site identifier to use for image resizing for an incoming request. 6 | * This identifier can be obtained before resolving the request URL. 7 | */ 8 | export function getImageResizingContextId(url: URL): string { 9 | if (isProxyRequest(url)) { 10 | return getProxyRequestIdentifier(url); 11 | } 12 | if (isPreviewRequest(url)) { 13 | return getPreviewRequestIdentifier(url); 14 | } 15 | 16 | return url.host; 17 | } 18 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/DocumentView/InlineIcon.tsx: -------------------------------------------------------------------------------- 1 | import type { DocumentInlineIcon } from '@gitbook/api'; 2 | 3 | import { tcls } from '@/lib/tailwind'; 4 | import { Icon, type IconName } from '@gitbook/icons'; 5 | import type { InlineProps } from './Inline'; 6 | import { textColorToStyle } from './utils/colors'; 7 | 8 | export async function InlineIcon(props: InlineProps) { 9 | const { inline } = props; 10 | const { color, icon } = inline.data; 11 | 12 | return ( 13 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /packages/gitbook/src/components/Embeddable/EmbeddableDocsPageControlButtons.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { tString, useLanguage } from '@/intl/client'; 4 | import { Button } from '../primitives'; 5 | 6 | export function EmbeddableDocsPageControlButtons(props: { href: string }) { 7 | const { href } = props; 8 | const language = useLanguage(); 9 | 10 | return ( 11 |