mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 14:00:28 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 32a73b55d4 | |||
| 0426312d6c | |||
| ede2335fb3 | |||
| 709f1a1ccb | |||
| 24b785cbfb | |||
| acc3f2f418 | |||
| d4a653d6a9 | |||
| 7e74d25447 | |||
| 3445db41ce | |||
| d1bd02a6f5 | |||
| 24cd72e088 | |||
| 47f7558c38 | |||
| de747b7b33 | |||
| 8e8b73fbd9 | |||
| e966e33e8f | |||
| bd0ca5babd | |||
| f6bacea1ae |
@@ -4,7 +4,7 @@
|
|||||||
"commit": false,
|
"commit": false,
|
||||||
"fixed": [],
|
"fixed": [],
|
||||||
"linked": [],
|
"linked": [],
|
||||||
"access": "restricted",
|
"access": "public",
|
||||||
"baseBranch": "main",
|
"baseBranch": "main",
|
||||||
"updateInternalDependencies": "patch",
|
"updateInternalDependencies": "patch",
|
||||||
"ignore": []
|
"ignore": []
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
|
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
|
||||||
directory: ./.vercel/output/static
|
directory: ./packages/gitbook/.vercel/output/static
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
workingDirectory: ./
|
workingDirectory: ./
|
||||||
- name: Outputs
|
- name: Outputs
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PUPPETEER_SKIP_DOWNLOAD: 1
|
PUPPETEER_SKIP_DOWNLOAD: 1
|
||||||
- name: Run pagespeed tests
|
- name: Run pagespeed tests
|
||||||
run: bun ./tests/pagespeed-testing.ts $DEPLOYMENT_URL
|
run: bun ./packages/gitbook/tests/pagespeed-testing.ts $DEPLOYMENT_URL
|
||||||
env:
|
env:
|
||||||
DEPLOYMENT_URL: ${{needs.deploy.outputs.deployment_url}}
|
DEPLOYMENT_URL: ${{needs.deploy.outputs.deployment_url}}
|
||||||
PAGESPEED_API_KEY: ${{ secrets.PAGESPEED_API_KEY }}
|
PAGESPEED_API_KEY: ${{ secrets.PAGESPEED_API_KEY }}
|
||||||
|
|||||||
@@ -31,5 +31,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
publish: npm run release
|
publish: npm run release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# Using a PAT instead of GITHUB_TOKEN because we need to run workflows when releases are created
|
||||||
|
# https://github.com/orgs/community/discussions/26875#discussioncomment-3253761
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_PERSONAL_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|||||||
+3
-29
@@ -5,16 +5,6 @@ node_modules
|
|||||||
/.pnp
|
/.pnp
|
||||||
.pnp.js
|
.pnp.js
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# next.js
|
|
||||||
/.next/
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.pem
|
*.pem
|
||||||
@@ -24,25 +14,9 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
# local env files
|
# Turbo
|
||||||
.env*.local
|
.turbo
|
||||||
|
|
||||||
# vercel
|
# Vercel
|
||||||
.vercel
|
.vercel
|
||||||
|
|
||||||
# typescript
|
|
||||||
*.tsbuildinfo
|
|
||||||
next-env.d.ts
|
|
||||||
|
|
||||||
# visual tests
|
|
||||||
screenshots/
|
|
||||||
|
|
||||||
# Sentry Config File
|
|
||||||
.sentryclirc
|
|
||||||
/test-results/
|
|
||||||
/playwright-report/
|
|
||||||
/blob-report/
|
|
||||||
/playwright/.cache/
|
|
||||||
|
|
||||||
# Generated public files
|
|
||||||
/public/~gitbook/static/
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
.next
|
.next
|
||||||
|
.vercel
|
||||||
|
|
||||||
# Generated
|
# Generated
|
||||||
packages/emoji-codepoints/index.ts
|
packages/emoji-codepoints/index.ts
|
||||||
|
packages/gitbook/public/~gitbook/static/
|
||||||
|
|||||||
+13
-79
@@ -2,95 +2,29 @@
|
|||||||
"name": "gitbook",
|
"name": "gitbook",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"packageManager": "bun@1.1.18",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "turbo run dev",
|
||||||
"build": "next build",
|
"build": "turbo run build",
|
||||||
"build:cloudflare": "next-on-pages",
|
"build:cloudflare": "turbo run build:cloudflare",
|
||||||
"start": "next start",
|
"lint": "turbo run lint",
|
||||||
"lint": "next lint",
|
"typecheck": "turbo run typecheck",
|
||||||
"format": "prettier ./ --ignore-unknown --write",
|
"format": "prettier ./ --ignore-unknown --write",
|
||||||
"format:check": "prettier ./ --ignore-unknown --list-different",
|
"format:check": "prettier ./ --ignore-unknown --list-different",
|
||||||
"typecheck": "tsc --noEmit",
|
"unit": "turbo run unit",
|
||||||
"unit": "bun test {src,packages}",
|
"e2e": "turbo run e2e",
|
||||||
"e2e": "playwright test",
|
|
||||||
"changeset": "changeset",
|
"changeset": "changeset",
|
||||||
"release": "changeset publish",
|
"release": "turbo run build && changeset publish"
|
||||||
"postinstall": "rm -rf ./public/~gitbook/static/mathjax@3.2.2 && mkdir -p ./public/~gitbook/static/ && cp -R node_modules/mathjax/es5 ./public/~gitbook/static/mathjax@3.2.2"
|
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
|
||||||
"@geist-ui/icons": "^1.0.2",
|
|
||||||
"@gitbook/api": "^0.56.0",
|
|
||||||
"@radix-ui/react-checkbox": "^1.0.4",
|
|
||||||
"@radix-ui/react-popover": "^1.0.7",
|
|
||||||
"@sentry/nextjs": "^7.94.1",
|
|
||||||
"@sindresorhus/fnv1a": "^3.1.0",
|
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
|
||||||
"@tailwindcss/typography": "^0.5.10",
|
|
||||||
"@upstash/redis": "^1.27.1",
|
|
||||||
"ajv": "^8.12.0",
|
|
||||||
"assert-never": "^1.2.1",
|
|
||||||
"bun-types": "^1.0.7",
|
|
||||||
"classnames": "^2.5.1",
|
|
||||||
"content-security-policy-merger": "^1.0.0",
|
|
||||||
"framer-motion": "^10.16.14",
|
|
||||||
"js-cookie": "^3.0.5",
|
|
||||||
"jsontoxml": "^1.0.1",
|
|
||||||
"katex": "^0.16.9",
|
|
||||||
"mathjax": "^3.2.2",
|
|
||||||
"memoizee": "^0.4.15",
|
|
||||||
"next": "^14.1.3",
|
|
||||||
"next-themes": "^0.2.1",
|
|
||||||
"nuqs": "^1.17.4",
|
|
||||||
"object-hash": "^3.0.0",
|
|
||||||
"openapi-types": "^12.1.3",
|
|
||||||
"p-map": "^7.0.0",
|
|
||||||
"parse-cache-control": "^1.0.1",
|
|
||||||
"react": "^18",
|
|
||||||
"react-dom": "^18",
|
|
||||||
"react-hotkeys-hook": "^4.4.1",
|
|
||||||
"recoil": "^0.7.7",
|
|
||||||
"rehype-sanitize": "^6.0.0",
|
|
||||||
"rehype-stringify": "^10.0.0",
|
|
||||||
"remark-gfm": "^4.0.0",
|
|
||||||
"remark-parse": "^11.0.0",
|
|
||||||
"remark-rehype": "^11.1.0",
|
|
||||||
"rison": "^0.1.1",
|
|
||||||
"server-only": "^0.0.1",
|
|
||||||
"shiki": "^1.2.0",
|
|
||||||
"tailwind-merge": "^2.2.0",
|
|
||||||
"tailwind-shades": "^1.1.2",
|
|
||||||
"unified": "^11.0.4",
|
|
||||||
"url-join": "^5.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@argos-ci/playwright": "^2.0.0",
|
|
||||||
"@changesets/cli": "^2.27.7",
|
"@changesets/cli": "^2.27.7",
|
||||||
"@cloudflare/next-on-pages": "^1.11.3",
|
|
||||||
"@cloudflare/workers-types": "^4.20231218.0",
|
|
||||||
"@playwright/test": "^1.42.1",
|
|
||||||
"@types/js-cookie": "^3.0.6",
|
|
||||||
"@types/jsontoxml": "^1.0.5",
|
|
||||||
"@types/jsonwebtoken": "^9.0.6",
|
|
||||||
"@types/katex": "^0.16.5",
|
|
||||||
"@types/node": "^20",
|
|
||||||
"@types/object-hash": "^3.0.6",
|
|
||||||
"@types/parse-cache-control": "^1.0.4",
|
|
||||||
"@types/psi": "^4.1.6",
|
|
||||||
"@types/react": "^18",
|
|
||||||
"@types/react-dom": "^18",
|
|
||||||
"@types/rison": "^0.0.9",
|
|
||||||
"autoprefixer": "^10",
|
|
||||||
"eslint": "^8",
|
|
||||||
"eslint-config-next": "13.5.6",
|
|
||||||
"eslint-plugin-import": "^2.29.0",
|
|
||||||
"jsonwebtoken": "^9.0.2",
|
|
||||||
"postcss": "^8",
|
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
"psi": "^4.1.0",
|
"turbo": "^2.0.9"
|
||||||
"tailwindcss": "^3.4.0",
|
},
|
||||||
"typescript": "^5"
|
"patchedDependencies": {
|
||||||
|
"@vercel/next@4.0.15": "patches/@vercel%2Fnext@4.0.15.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# next.js
|
||||||
|
/.next/
|
||||||
|
/out/
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env*.local
|
||||||
|
|
||||||
|
# vercel
|
||||||
|
.vercel
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
next-env.d.ts
|
||||||
|
|
||||||
|
# visual tests
|
||||||
|
screenshots/
|
||||||
|
|
||||||
|
# Sentry Config File
|
||||||
|
.sentryclirc
|
||||||
|
|
||||||
|
/test-results/
|
||||||
|
/playwright-report/
|
||||||
|
/blob-report/
|
||||||
|
/playwright/.cache/
|
||||||
|
|
||||||
|
# Generated public files
|
||||||
|
/public/~gitbook/static/
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# gitbook
|
||||||
|
|
||||||
|
## 0.3.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- 24b785c: Update shiki for code block syntax highlighting, with support for more languages and fixes for diffs. It also patches the deployment on Cloudflare to support edge functions larger than 4MB.
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- acc3f2f: Fix error with the "Try it" of OpenAPI block because of the Scalar proxy failing on Cloudflare with the `cache` option
|
||||||
|
- Updated dependencies [709f1a1]
|
||||||
|
- Updated dependencies [ede2335]
|
||||||
|
- Updated dependencies [0426312]
|
||||||
|
- @gitbook/react-openapi@0.6.0
|
||||||
|
|
||||||
|
## 0.2.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [3445db4]
|
||||||
|
- @gitbook/react-contentkit@0.5.0
|
||||||
|
- @gitbook/react-openapi@0.5.0
|
||||||
|
- @gitbook/react-math@0.5.0
|
||||||
|
|
||||||
|
## 0.2.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [24cd72e]
|
||||||
|
- @gitbook/react-contentkit@0.4.0
|
||||||
|
- @gitbook/react-math@0.4.0
|
||||||
|
- @gitbook/react-openapi@0.4.0
|
||||||
|
|
||||||
|
## 0.2.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- de747b7: Refactor the repository to be a proper monorepo and publish JS files on NPM instead of TypeScript files.
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [de747b7]
|
||||||
|
- Updated dependencies [de747b7]
|
||||||
|
- @gitbook/react-contentkit@0.3.0
|
||||||
|
- @gitbook/react-openapi@0.3.0
|
||||||
|
- @gitbook/react-math@0.3.0
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"name": "gitbook",
|
||||||
|
"version": "0.3.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "next dev",
|
||||||
|
"build": "next build",
|
||||||
|
"build:cloudflare": "next-on-pages",
|
||||||
|
"start": "next start",
|
||||||
|
"lint": "next lint",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
|
"e2e": "playwright test",
|
||||||
|
"unit": "bun test {src,packages}",
|
||||||
|
"postinstall": "rm -rf ./public/~gitbook/static/mathjax@3.2.2 && mkdir -p ./public/~gitbook/static/ && cp -R ../../node_modules/mathjax/es5 ./public/~gitbook/static/mathjax@3.2.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@geist-ui/icons": "^1.0.2",
|
||||||
|
"@gitbook/api": "^0.56.0",
|
||||||
|
"@gitbook/react-math": "workspace:*",
|
||||||
|
"@gitbook/react-openapi": "workspace:*",
|
||||||
|
"@gitbook/react-contentkit": "workspace:*",
|
||||||
|
"@radix-ui/react-checkbox": "^1.0.4",
|
||||||
|
"@radix-ui/react-popover": "^1.0.7",
|
||||||
|
"@sentry/nextjs": "^7.94.1",
|
||||||
|
"@sindresorhus/fnv1a": "^3.1.0",
|
||||||
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
|
"@tailwindcss/typography": "^0.5.10",
|
||||||
|
"@upstash/redis": "^1.27.1",
|
||||||
|
"ajv": "^8.12.0",
|
||||||
|
"assert-never": "^1.2.1",
|
||||||
|
"bun-types": "^1.1.20",
|
||||||
|
"classnames": "^2.5.1",
|
||||||
|
"content-security-policy-merger": "^1.0.0",
|
||||||
|
"framer-motion": "^10.16.14",
|
||||||
|
"js-cookie": "^3.0.5",
|
||||||
|
"jsontoxml": "^1.0.1",
|
||||||
|
"katex": "^0.16.9",
|
||||||
|
"mathjax": "^3.2.2",
|
||||||
|
"memoizee": "^0.4.15",
|
||||||
|
"next": "^14.1.3",
|
||||||
|
"next-themes": "^0.2.1",
|
||||||
|
"nuqs": "^1.17.4",
|
||||||
|
"object-hash": "^3.0.0",
|
||||||
|
"openapi-types": "^12.1.3",
|
||||||
|
"p-map": "^7.0.0",
|
||||||
|
"parse-cache-control": "^1.0.1",
|
||||||
|
"react": "^18",
|
||||||
|
"react-dom": "^18",
|
||||||
|
"react-hotkeys-hook": "^4.4.1",
|
||||||
|
"recoil": "^0.7.7",
|
||||||
|
"rehype-sanitize": "^6.0.0",
|
||||||
|
"rehype-stringify": "^10.0.0",
|
||||||
|
"remark-gfm": "^4.0.0",
|
||||||
|
"remark-parse": "^11.0.0",
|
||||||
|
"remark-rehype": "^11.1.0",
|
||||||
|
"rison": "^0.1.1",
|
||||||
|
"server-only": "^0.0.1",
|
||||||
|
"shiki": "^1.11.1",
|
||||||
|
"tailwind-merge": "^2.2.0",
|
||||||
|
"tailwind-shades": "^1.1.2",
|
||||||
|
"unified": "^11.0.4",
|
||||||
|
"url-join": "^5.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@argos-ci/playwright": "^2.0.0",
|
||||||
|
"@playwright/test": "^1.42.1",
|
||||||
|
"@cloudflare/next-on-pages": "^1.11.3",
|
||||||
|
"@cloudflare/workers-types": "^4.20231218.0",
|
||||||
|
"@types/js-cookie": "^3.0.6",
|
||||||
|
"@types/jsontoxml": "^1.0.5",
|
||||||
|
"@types/jsonwebtoken": "^9.0.6",
|
||||||
|
"@types/node": "^20",
|
||||||
|
"@types/object-hash": "^3.0.6",
|
||||||
|
"@types/parse-cache-control": "^1.0.4",
|
||||||
|
"@types/psi": "^4.1.6",
|
||||||
|
"@types/react": "^18.3.3",
|
||||||
|
"@types/react-dom": "^18.3.0",
|
||||||
|
"@types/rison": "^0.0.9",
|
||||||
|
"autoprefixer": "^10",
|
||||||
|
"eslint": "^8",
|
||||||
|
"eslint-config-next": "^14.2.5",
|
||||||
|
"eslint-plugin-import": "^2.29.1",
|
||||||
|
"jsonwebtoken": "^9.0.2",
|
||||||
|
"postcss": "^8",
|
||||||
|
"psi": "^4.1.0",
|
||||||
|
"tailwindcss": "^3.4.0",
|
||||||
|
"typescript": "^5.5.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-3
@@ -15,7 +15,7 @@ export const runtime = 'edge';
|
|||||||
*/
|
*/
|
||||||
export async function GET(req: NextRequest) {
|
export async function GET(req: NextRequest) {
|
||||||
const { pages: rootPages } = await getSpaceContentData(getContentPointer());
|
const { pages: rootPages } = await getSpaceContentData(getContentPointer());
|
||||||
const pages = flattenPages(rootPages);
|
const pages = flattenPages(rootPages, (page) => !page.hidden);
|
||||||
const urls = pages.map(({ page, depth }) => {
|
const urls = pages.map(({ page, depth }) => {
|
||||||
// Decay priority with depth
|
// Decay priority with depth
|
||||||
const priority = Math.pow(2, -0.25 * depth);
|
const priority = Math.pow(2, -0.25 * depth);
|
||||||
@@ -66,13 +66,16 @@ export async function GET(req: NextRequest) {
|
|||||||
|
|
||||||
type FlatPageEntry = { page: RevisionPageDocument; depth: number };
|
type FlatPageEntry = { page: RevisionPageDocument; depth: number };
|
||||||
|
|
||||||
function flattenPages(rootPags: RevisionPage[]): FlatPageEntry[] {
|
function flattenPages(
|
||||||
|
rootPags: RevisionPage[],
|
||||||
|
filter: (page: RevisionPageDocument) => boolean,
|
||||||
|
): FlatPageEntry[] {
|
||||||
const flattenPage = (
|
const flattenPage = (
|
||||||
page: RevisionPageDocument | RevisionPageGroup,
|
page: RevisionPageDocument | RevisionPageGroup,
|
||||||
depth: number,
|
depth: number,
|
||||||
): FlatPageEntry[] => {
|
): FlatPageEntry[] => {
|
||||||
return [
|
return [
|
||||||
...(page.type === 'document' ? [{ page, depth }] : []),
|
...(page.type === 'document' && filter(page) ? [{ page, depth }] : []),
|
||||||
...page.pages.flatMap((child) =>
|
...page.pages.flatMap((child) =>
|
||||||
child.type === 'link' ? [] : flattenPage(child, depth + 1),
|
child.type === 'link' ? [] : flattenPage(child, depth + 1),
|
||||||
),
|
),
|
||||||
@@ -30,7 +30,7 @@ export async function POST(req: NextRequest) {
|
|||||||
// no-cors, *cors, same-origin
|
// no-cors, *cors, same-origin
|
||||||
// mode: 'cors', // Not supported on Cloudflare Workers
|
// mode: 'cors', // Not supported on Cloudflare Workers
|
||||||
// *default, no-cache, reload, force-cache, only-if-cached
|
// *default, no-cache, reload, force-cache, only-if-cached
|
||||||
cache: 'no-cache',
|
// cache: 'no-cache', // Not supported on Cloudflare Workers
|
||||||
// include, *same-origin, omit
|
// include, *same-origin, omit
|
||||||
// credentials: 'include', // Not supported on Cloudflare Workers
|
// credentials: 'include', // Not supported on Cloudflare Workers
|
||||||
headers: requestBody.headers,
|
headers: requestBody.headers,
|
||||||
+6
@@ -9,6 +9,9 @@
|
|||||||
--shiki-token-string-expression: #6a4906;
|
--shiki-token-string-expression: #6a4906;
|
||||||
--shiki-token-punctuation: theme('colors.pomegranate.700/.92');
|
--shiki-token-punctuation: theme('colors.pomegranate.700/.92');
|
||||||
--shiki-token-link: theme('colors.dark.DEFAULT');
|
--shiki-token-link: theme('colors.dark.DEFAULT');
|
||||||
|
--shiki-token-inserted: #22863a;
|
||||||
|
--shiki-token-deleted: #b31d28;
|
||||||
|
--shiki-token-changed: #8250df;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.dark {
|
html.dark {
|
||||||
@@ -22,4 +25,7 @@ html.dark {
|
|||||||
--shiki-token-string-expression: theme('colors.light.4');
|
--shiki-token-string-expression: theme('colors.light.4');
|
||||||
--shiki-token-punctuation: #acc6ee;
|
--shiki-token-punctuation: #acc6ee;
|
||||||
--shiki-token-link: theme('colors.pomegranate.400');
|
--shiki-token-link: theme('colors.pomegranate.400');
|
||||||
|
--shiki-token-inserted: #85e89d;
|
||||||
|
--shiki-token-deleted: #fdaeb7;
|
||||||
|
--shiki-token-changed: #56b6c2;
|
||||||
}
|
}
|
||||||
+1
-2
@@ -15,13 +15,12 @@ import {
|
|||||||
Lock,
|
Lock,
|
||||||
} from '@geist-ui/icons';
|
} from '@geist-ui/icons';
|
||||||
import { ContentKitContext, DocumentBlockIntegration } from '@gitbook/api';
|
import { ContentKitContext, DocumentBlockIntegration } from '@gitbook/api';
|
||||||
|
import { ContentKit, ContentKitOutput, ContentKitServerContext } from '@gitbook/react-contentkit';
|
||||||
|
|
||||||
import { ignoreAPIError, renderIntegrationUi } from '@/lib/api';
|
import { ignoreAPIError, renderIntegrationUi } from '@/lib/api';
|
||||||
import { parseMarkdown } from '@/lib/markdown';
|
import { parseMarkdown } from '@/lib/markdown';
|
||||||
import { tcls } from '@/lib/tailwind';
|
import { tcls } from '@/lib/tailwind';
|
||||||
|
|
||||||
import { ContentKit, ContentKitOutput, ContentKitServerContext } from '@gitbook/react-contentkit';
|
|
||||||
|
|
||||||
import type { BlockProps } from '../Block';
|
import type { BlockProps } from '../Block';
|
||||||
import './contentkit.css';
|
import './contentkit.css';
|
||||||
import { PlainCodeBlock } from '../CodeBlock';
|
import { PlainCodeBlock } from '../CodeBlock';
|
||||||
+1
-2
@@ -1,10 +1,9 @@
|
|||||||
import { DocumentBlockMath, DocumentInlineMath } from '@gitbook/api';
|
import { DocumentBlockMath, DocumentInlineMath } from '@gitbook/api';
|
||||||
|
import { MathFormula } from '@gitbook/react-math';
|
||||||
|
|
||||||
import { getStaticFileURL } from '@/lib/assets';
|
import { getStaticFileURL } from '@/lib/assets';
|
||||||
import { tcls } from '@/lib/tailwind';
|
import { tcls } from '@/lib/tailwind';
|
||||||
|
|
||||||
import { MathFormula } from '@gitbook/react-math';
|
|
||||||
|
|
||||||
import { BlockProps } from './Block';
|
import { BlockProps } from './Block';
|
||||||
import { InlineProps } from './Inline';
|
import { InlineProps } from './Inline';
|
||||||
|
|
||||||
+4
-4
@@ -1,13 +1,12 @@
|
|||||||
import { ChevronDown, ChevronRight } from '@geist-ui/icons';
|
import { ChevronDown, ChevronRight } from '@geist-ui/icons';
|
||||||
import { DocumentBlockSwagger } from '@gitbook/api';
|
import { DocumentBlockSwagger } from '@gitbook/api';
|
||||||
|
import { OpenAPIOperation } from '@gitbook/react-openapi';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { LoadingPane } from '@/components/primitives';
|
import { LoadingPane } from '@/components/primitives';
|
||||||
import { fetchOpenAPIBlock } from '@/lib/openapi';
|
import { fetchOpenAPIBlock } from '@/lib/openapi';
|
||||||
import { tcls } from '@/lib/tailwind';
|
import { tcls } from '@/lib/tailwind';
|
||||||
|
|
||||||
import { OpenAPIOperation } from '@gitbook/react-openapi';
|
|
||||||
|
|
||||||
import { BlockProps } from '../Block';
|
import { BlockProps } from '../Block';
|
||||||
import { PlainCodeBlock } from '../CodeBlock';
|
import { PlainCodeBlock } from '../CodeBlock';
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ export async function OpenAPI(props: BlockProps<DocumentBlockSwagger>) {
|
|||||||
|
|
||||||
async function OpenAPIBody(props: BlockProps<DocumentBlockSwagger>) {
|
async function OpenAPIBody(props: BlockProps<DocumentBlockSwagger>) {
|
||||||
const { block, context } = props;
|
const { block, context } = props;
|
||||||
const { data, error } = await fetchOpenAPIBlock(block, context.resolveContentRef);
|
const { data, specUrl, error } = await fetchOpenAPIBlock(block, context.resolveContentRef);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
@@ -47,7 +46,7 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockSwagger>) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data || !specUrl) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +60,7 @@ async function OpenAPIBody(props: BlockProps<DocumentBlockSwagger>) {
|
|||||||
},
|
},
|
||||||
CodeBlock: PlainCodeBlock,
|
CodeBlock: PlainCodeBlock,
|
||||||
defaultInteractiveOpened: context.mode === 'print',
|
defaultInteractiveOpened: context.mode === 'print',
|
||||||
|
specUrl,
|
||||||
}}
|
}}
|
||||||
className="openapi-block"
|
className="openapi-block"
|
||||||
/>
|
/>
|
||||||
+29
-23
@@ -1,4 +1,7 @@
|
|||||||
|
@import '@scalar/api-client-react/style.css';
|
||||||
|
|
||||||
.light .scalar-modal-layout,
|
.light .scalar-modal-layout,
|
||||||
|
.light .scalar-app,
|
||||||
.light .scalar {
|
.light .scalar {
|
||||||
--scalar-color-1: color-mix(
|
--scalar-color-1: color-mix(
|
||||||
in srgb,
|
in srgb,
|
||||||
@@ -50,8 +53,13 @@
|
|||||||
--scalar-button-1: rgb(49 53 56);
|
--scalar-button-1: rgb(49 53 56);
|
||||||
--scalar-button-1-color: #fff;
|
--scalar-button-1-color: #fff;
|
||||||
--scalar-button-1-hover: rgb(28 31 33);
|
--scalar-button-1-hover: rgb(28 31 33);
|
||||||
|
|
||||||
|
--scalar-shadow-1: 0 1px 3px 0 rgba(0, 0, 0, 0.11);
|
||||||
|
--scalar-shadow-2: rgba(0, 0, 0, 0.08) 0px 13px 20px 0px, rgba(0, 0, 0, 0.08) 0px 3px 8px 0px,
|
||||||
|
#eeeeed 0px 0 0 1px;
|
||||||
}
|
}
|
||||||
.dark .scalar-modal-layout,
|
.dark .scalar-modal-layout,
|
||||||
|
.dark .scalar-app,
|
||||||
.dark .scalar {
|
.dark .scalar {
|
||||||
--scalar-color-1: color-mix(
|
--scalar-color-1: color-mix(
|
||||||
in srgb,
|
in srgb,
|
||||||
@@ -102,8 +110,13 @@
|
|||||||
--scalar-button-1: #f6f6f6;
|
--scalar-button-1: #f6f6f6;
|
||||||
--scalar-button-1-color: #000;
|
--scalar-button-1-color: #000;
|
||||||
--scalar-button-1-hover: #e7e7e7;
|
--scalar-button-1-hover: #e7e7e7;
|
||||||
|
|
||||||
|
--scalar-shadow-1: 0 1px 3px 0 rgb(0, 0, 0, 0.1);
|
||||||
|
--scalar-shadow-2: rgba(15, 15, 15, 0.2) 0px 3px 6px, rgba(15, 15, 15, 0.4) 0px 9px 24px,
|
||||||
|
0 0 0 1px rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
.scalar-modal-layout,
|
.scalar-modal-layout,
|
||||||
|
.scalar-app,
|
||||||
.scalar {
|
.scalar {
|
||||||
--scalar-font: initial;
|
--scalar-font: initial;
|
||||||
--scalar-font-code: var(--font-mono);
|
--scalar-font-code: var(--font-mono);
|
||||||
@@ -165,7 +178,7 @@
|
|||||||
.scalar-api-client__close:hover {
|
.scalar-api-client__close:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.scalar .scalar-app {
|
.scalar .scalar-app-layout {
|
||||||
background: var(--scalar-background-3);
|
background: var(--scalar-background-3);
|
||||||
height: calc(100dvh - 100px);
|
height: calc(100dvh - 100px);
|
||||||
max-width: 1280px;
|
max-width: 1280px;
|
||||||
@@ -202,23 +215,6 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
animation: scalardrawerexitfadein 0.35s forwards;
|
animation: scalardrawerexitfadein 0.35s forwards;
|
||||||
}
|
}
|
||||||
.scalar .scalar-app-exit:before {
|
|
||||||
content: '\00d7';
|
|
||||||
font-family: sans-serif;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
font-size: 30px;
|
|
||||||
font-weight: 100;
|
|
||||||
line-height: 50px;
|
|
||||||
right: 12px;
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
.scalar .scalar-app-exit:hover:before {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
@keyframes scalardrawerexitfadein {
|
@keyframes scalardrawerexitfadein {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -305,11 +301,6 @@
|
|||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
@supports (-moz-appearance: none) {
|
|
||||||
.scalar .custom-scroll {
|
|
||||||
padding-right: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.scalar .custom-scroll:hover {
|
.scalar .custom-scroll:hover {
|
||||||
scrollbar-color: rgba(0, 0, 0, 0.24) transparent;
|
scrollbar-color: rgba(0, 0, 0, 0.24) transparent;
|
||||||
}
|
}
|
||||||
@@ -347,3 +338,18 @@
|
|||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.dark .scalar .client-wrapper-bg-color {
|
||||||
|
background: linear-gradient(
|
||||||
|
color-mix(in srgb, var(--tw-bg-base) 6%, transparent) 1%,
|
||||||
|
color-mix(in srgb, var(--scalar-background-1) 30%, black) 9%
|
||||||
|
);
|
||||||
|
}
|
||||||
|
.light .scalar .client-wrapper-bg-color {
|
||||||
|
background-color: var(--scalar-background-2) !important;
|
||||||
|
}
|
||||||
|
.scalar .gitbook-show {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
.scalar .gitbook-hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user