Compare commits

..

1632 Commits

Author SHA1 Message Date
Samy Pessé 75b52eac28 Version Packages (#3651)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-10 15:11:33 +02:00
Greg Bergé ad4d07dc06 Support inline icon colors (#3717) 2025-10-10 14:51:40 +02:00
Greg Bergé 75086740f8 Fix bundling of embed package (#3716) 2025-10-10 10:57:06 +02:00
Nolann B. eea8f1e00f Enhance OpenAPI security scopes handling (#3712) 2025-10-09 10:16:12 +02:00
Greg Bergé 4f9abfb6f2 Display headings from reusable content in TOC (#3708) 2025-10-08 12:17:05 +02:00
conico974 252afceab0 Store customization in a cookie for preview route (#3707)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-10-08 10:37:52 +02:00
Viktor Renkema bef191660a Allow hiding toolbar for one session or persistent (#3698) 2025-10-08 09:48:38 +02:00
Zeno Kapitein 145625142d Unify section display condition (#3706) 2025-10-07 15:12:08 +02:00
Greg Bergé f70a2aa310 Disable flashing when navigating between sections (#3705) 2025-10-07 12:00:42 +02:00
Samy Pessé 56e46ce8ab Add Italian translation (#3704) 2025-10-06 17:07:30 +02:00
Nolann B. 754cc11e0b Fix merge logic for allOf alternatives (#3515) 2025-10-06 14:37:51 +02:00
Nolann B. 3551d147e9 Move to urls for page actions (#3703) 2025-10-06 09:42:37 +02:00
Zeno Kapitein 162cfe4163 Hide sections if only one is present (#3701) 2025-10-04 20:16:02 +02:00
Nolann B. 6815dd197e Fix markdownPageURL for PageActions (#3702) 2025-10-04 19:02:30 +02:00
Zeno Kapitein d74f8a7098 Improve wide page width (#3692) 2025-10-03 18:52:05 +02:00
Zeno Kapitein 1e53f46521 Fix button content truncate (#3693) 2025-10-03 18:51:32 +02:00
Claire Chabas 1a6216df4f Fix URL used for Ask to LLM (#3697) 2025-10-03 14:24:24 +02:00
Nolann B. a629900324 Add dev script for @gitbook/expr (#3700) 2025-10-03 13:23:15 +02:00
Nolann B. a4c33997fe Fix OpenAPI alternatives not showing (#3699) 2025-10-03 13:06:10 +02:00
Brett Jephson badf3a92f6 RND-8165: make sure we get alt text coming through on InlineImage (#3696) 2025-10-03 09:40:34 +01:00
Claire Chabas e0fb9ac3ca Support image frame (#3695) 2025-10-02 10:17:48 +02:00
spastorelli f3e40410c4 Adapt OpenAPI code samples to prefill API key using visitor data (#3666) 2025-09-30 11:09:05 +02:00
spastorelli 8e99871004 Highlight discriminator properties in oneOf, allOf, anyOf objects (#3691) 2025-09-29 17:09:21 +02:00
Zeno Kapitein 1e4e54e752 Fix rounded outline items (#3694) 2025-09-29 13:33:40 +02:00
spastorelli 50c1be3447 Move inline expression evaluation from API to GBO (#3687) 2025-09-26 10:55:09 +02:00
spastorelli 319a1e536c Ensure operation security reqs inherits from spec-level when not defined (#3690) 2025-09-26 09:11:52 +02:00
conico974 50cb0c6e15 Fix NavigationLoader on search and cmd/click (#3689)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-26 08:34:41 +02:00
Zeno Kapitein ceb32b1a2e Redo search scopes (#3688)
Co-authored-by: Claire Chabas <claire.chabas@gmail.com>
2025-09-25 16:49:53 +00:00
Zeno Kapitein f8c54b4d34 Improve assistant demo (#3686) 2025-09-25 17:07:07 +02:00
Greg Bergé c06ad70f8a Improve fonts loading (#3682) 2025-09-25 13:17:21 +02:00
Brett Jephson 0ef5dc8538 Update column width sizing (#3676) 2025-09-25 08:14:15 +01:00
Zeno Kapitein 28adc9b5f1 Add graphic to embed assistant demo page (#3685) 2025-09-24 14:37:41 +00:00
Zeno Kapitein 912d1693f5 Fix section group alignment (#3684) 2025-09-24 13:58:34 +00:00
Samy Pessé c23d4ef331 Fix crash for card cover defined without objectFit (#3683) 2025-09-24 11:01:06 +02:00
Zeno Kapitein c21693fe50 Improve screen reader accessibility for hints (#3680) 2025-09-24 10:23:34 +02:00
Zeno Kapitein c06b3dd60d Improve default site icon (#3679) 2025-09-24 10:22:49 +02:00
conico974 f173e014db Use cloudflare regional cache instead of our own implementation. (#3673)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-24 10:11:11 +02:00
conico974 1b458c436e Fix NavigationLoader not visible with bold header (#3681)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-24 09:54:57 +02:00
conico974 b42b0b3910 Add navigation loader and rename context provider (#3642)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
Co-authored-by: Zeno Kapitein <zeno@gitbook.io>
2025-09-23 15:00:27 +02:00
Brett Jephson 2fc21272ff RND-7985: accessible search (#3637) 2025-09-23 11:36:50 +01:00
Zeno Kapitein 379d486488 Expose "Best match" when site has translations (#3670) 2025-09-22 22:31:17 +02:00
Zeno Kapitein cba583a31c Use siteSpace title instead of space title in search (#3677) 2025-09-22 18:03:50 +02:00
Zeno Kapitein 7a504b7cc5 Fix OpenAPI response dropdown & vertical overflow (#3678) 2025-09-22 18:03:43 +02:00
Addison 8ec5fd0986 Add blob: to style source for integrations (#3675) 2025-09-22 18:41:16 +09:00
spastorelli 529f940a45 Fix OpenAPISecurities and code sample not using operation security requirements (#3671) 2025-09-22 10:00:46 +02:00
Viktor Renkema 8a3c15911f Update tooltip labels in docs sites toolbars (#3674) 2025-09-22 09:28:42 +02:00
spastorelli d7948e34b2 Fix OpenAPI response showing as JSON instead of YAML (#3669) 2025-09-18 18:40:24 +02:00
conico974 9f42211993 Enhance tracking with geolocation headers and continent info in analytics proxy (#3667)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-18 18:31:21 +02:00
conico974 65e62307bf Update @opennextjs/cloudflare to version 1.8.3 (#3668)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-18 18:04:38 +02:00
spastorelli 469b332da2 Add support for inline expressions rendering with visitor data on GBO side (#3660) 2025-09-18 16:30:52 +02:00
Zeno Kapitein e434442f1e Support site section groups (#3664) 2025-09-18 15:28:39 +02:00
Samy Pessé 9344431bfc Fix API URL we proxy insights events to (#3665) 2025-09-18 13:14:25 +00:00
conico974 622ecbec1d Handle broken links in header and footer (#3663)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-18 11:22:57 +02:00
conico974 fa1382b289 Add responsive image sizes for RecordCard component (#3654)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-18 08:55:11 +02:00
Zeno Kapitein b8388e5a2a Add ScrollContainer component, use for section tabs (#3661) 2025-09-17 22:20:32 +02:00
Zeno Kapitein 2bce12798f Fix section group dropdown offset on big screens (#3662) 2025-09-17 19:10:52 +02:00
Greg Bergé f89e889d18 Convert relative URL to absolute in Markdown (page and copy) (#3659) 2025-09-17 18:12:01 +02:00
Zeno Kapitein 2b8a2d24b6 Add stable scroll gutter to search container (#3656) 2025-09-17 17:27:47 +02:00
Zeno Kapitein b85eccdff5 Refactor site section tabs (#3655) 2025-09-17 17:27:34 +02:00
Viktor Renkema d924e655c0 Add visibility label and smoothen magnification (#3657) 2025-09-16 16:34:21 +02:00
Zeno Kapitein b932e4e2e9 Scope search across sections and variants (#3640)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-16 12:07:29 +02:00
Samy Pessé ca4a3e8c9a Track utm on links from the toolbar (#3653) 2025-09-15 16:51:31 +02:00
John Cashman b498521196 Refactor robots.txt generation logic (#3621)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-09-15 14:37:02 +02:00
Samy Pessé 8a8cf2025d Skip using __session cookie if it's in the old format (#3652) 2025-09-15 12:10:51 +02:00
Samy Pessé ed7d47d9b8 Toolbar for authenticated GitBook users (#3650)
Co-authored-by: Viktor Renkema <vrenkema@gmail.com>
2025-09-15 10:32:23 +02:00
Viktor Renkema b5494cc04b Restyle the toolbar in CR and revision preview links (#3631)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-09-15 08:33:23 +02:00
Samy Pessé 229f2ba9d5 Version Packages (#3646)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-12 16:40:28 +02:00
spastorelli 6da36558f6 Fix exports in gitbook/expr package.json after removing src (#3648) 2025-09-12 16:20:29 +02:00
Samy Pessé ca71c1fad6 Fix MCP in production (#3647) 2025-09-12 14:59:47 +02:00
Samy Pessé 262afa357b Implement an MCP server on each docs site (#3641) 2025-09-12 13:19:16 +02:00
Samy Pessé 7375d3c597 Version Packages (#3645)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-12 11:37:22 +02:00
spastorelli 3548fa6dff Fix eval estree expr cjs named import when gitbook/expr is imported in playwright tests (#3643) 2025-09-12 11:20:33 +02:00
conico974 cb73040e0f Bump Next.js to version 15.4.0 (#3644)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-12 11:17:43 +02:00
Samy Pessé 872d36b64f Version Packages (#3629)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-11 18:06:31 +02:00
spastorelli e1ff17e655 Fix bundling of @gitbook/expr package (#3639) 2025-09-11 17:24:06 +02:00
Utku Ufuk f3010bd28a Stop using deprecated search API param (#3638) 2025-09-11 15:26:35 +03:00
spastorelli 8ff1e3b619 Port latest changes from gbx util-expr (#3636) 2025-09-09 18:55:41 +02:00
Viktor Renkema d7596bf454 Don't show toolbar when rendering within GitBook app preview (#3635) 2025-09-09 15:09:52 +02:00
Zeno Kapitein aea5eb10ae Persist language choice across sections (#3633) 2025-09-09 15:06:28 +02:00
Zeno Kapitein 1165a81cf5 Language selector fixes (#3632) 2025-09-08 17:22:42 +02:00
conico974 61d1a0192e Fix null contentRef handling in RecordColumnValue (#3566)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-08 13:54:58 +02:00
Zeno Kapitein f9a2977621 Better handling for external link "mailto:" in Hovered Card in GBO (#3630) 2025-09-08 10:31:30 +00:00
spastorelli 24f601d594 Small optim in resolveTryItPrefillForOperation and remove uneeded dep (#3628) 2025-09-08 10:29:59 +02:00
Samy Pessé 7b34537bbe Version Packages (#3599)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-06 11:40:05 +02:00
conico974 145f385fdb Add pagination for llms-full.txt file (#3619)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-05 17:20:25 +02:00
Greg Bergé 360aa1c6d6 Upgrade Scalar dependencies (#3626) 2025-09-05 16:57:21 +02:00
conico974 ccc0975240 Fix error on parameters being an object instead of an array (#3623)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-05 16:17:50 +02:00
Zeno Kapitein 791135040a Add language selector to site header (#3622) 2025-09-05 12:15:07 +00:00
spastorelli 12c9d765ff Adapt OpenAPI to eval adaptive exprs & prefill TryIt config (#3607) 2025-09-05 13:39:12 +02:00
Greg Bergé 45207288a1 Support bold in headings (#3609) 2025-09-05 11:47:39 +02:00
Viktor Renkema 177afa5828 Handle non-defined objectFit on card cover images (#3625) 2025-09-05 10:42:57 +02:00
Zeno Kapitein d51b79edbb Fix "Search bar is broken on site with sections when header is disabled" (#3624) 2025-09-04 13:48:08 +02:00
conico974 a2720ac49d Update @opennextjs/cloudflare to version 1.7.1 (#3620)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-09-03 16:09:27 +02:00
Viktor Renkema 5f6853d812 Support new object-fit property on individual card cover image (#3594) 2025-09-03 09:11:17 +02:00
Zeno Kapitein 17dd382dc3 Add "original" color step and apply to bg-primary-solid elements (#3618) 2025-09-02 16:08:21 +02:00
Nolann B. 98e42cfe79 Handle OpenAPI ignored responses (#3614) 2025-09-01 14:25:35 +02:00
Samy Pessé c890e01004 Fix order in robots.txt preventing indexation of images by Google (#3617) 2025-09-01 11:21:11 +00:00
Samy Pessé 659be551bb Track insight event when embedded assistant is displayed (#3616) 2025-09-01 12:59:40 +02:00
Zeno Kapitein 78a632b7fe Fix Edit on GitHub button doesn't take you to GitHub (#3615) 2025-09-01 12:01:36 +02:00
spastorelli 4927e964b7 Add support for YAML content type in request body/example (#3612) 2025-09-01 10:56:09 +02:00
Samy Pessé 262a9b198b Fix embed script caching (#3611) 2025-08-29 22:35:14 +02:00
Samy Pessé 4f3588240c Unify layout and fix tracking of ask_question (#3610) 2025-08-29 16:10:28 +02:00
Nolann B. abbae3ec4d Remove scroll-nojump utility and update layout structure (#3494)
Co-authored-by: Zeno Kapitein <zeno@gitbook.io>
2025-08-29 11:22:55 +02:00
conico974 1b8609ac60 fix next start not working (#3608)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-28 16:36:06 +02:00
Samy Pessé 193d591e9f Use space.language as source of truth (#3606) 2025-08-27 18:27:29 +02:00
Zeno Kapitein 1edc5d622a Assistant hold message (#3603) 2025-08-27 13:48:57 +00:00
Zeno Kapitein 61b8507996 OpenAPI: Make empty responses clickable (#3605) 2025-08-27 13:38:24 +00:00
Zeno Kapitein 6f368b5cf3 Fix embed assistant window width on small screens (#3604) 2025-08-27 15:33:37 +02:00
Brett Jephson 9201e2cf52 Add vertical align property to column block (#3596)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-08-27 13:58:26 +01:00
Zeno Kapitein 2e0d706d43 Fix corner radius of active section on "Line" sidebar style (#3601) 2025-08-27 13:15:07 +02:00
Nolann B. 7fefe4919c Catch OpenAPI validation errors (#3602) 2025-08-27 12:29:50 +02:00
Zeno Kapitein 729921f338 Move "Edit on Git" and "Export PDF" actions into page actions dropdown (#3574) 2025-08-27 11:32:55 +02:00
Zeno Kapitein 1839ea2678 Fix content min-height with sections (#3597) 2025-08-27 11:30:22 +02:00
Zeno Kapitein f08dd29364 Fix Search results are not clickable (#3595) 2025-08-26 20:33:37 +00:00
conico974 ca2dfa3065 Rollback to Next.js 15.3 (#3600)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-26 18:26:32 +02:00
Utku Ufuk 10ded437f0 Turn on the "noUncheckedIndexedAccess" flag in all TS config files (#3587) 2025-08-26 19:25:54 +03:00
Zeno Kapitein d1fdc13441 Remove ligatures from Lato font (#3592) 2025-08-26 15:04:22 +00:00
Zeno Kapitein a8fca0e033 Fix custom assistant keyboard shortcut (#3598) 2025-08-26 14:57:08 +00:00
Samy Pessé 9251b33959 Version Packages (#3535)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-26 14:21:26 +02:00
Samy Pessé 81a6bd756a Embeddable GitBook API (#3593) 2025-08-26 14:08:24 +02:00
spastorelli ada195d329 Add gitbook/expr package (#3586) 2025-08-25 13:10:19 +02:00
conico974 1211ebea9b Proxy analytics events (#3570)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-25 11:34:54 +02:00
Zeno Kapitein 2e6e28eb54 Fix: Long strings overflow out of message bubble in docs assistant (#3588) 2025-08-22 19:23:05 +02:00
Zeno Kapitein 854c448bad Custom assistants followup (#3584) 2025-08-22 17:32:10 +02:00
conico974 64a0b0f169 Add logging for request duration and response details in 2c (#3583)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-22 17:15:00 +02:00
Zeno Kapitein 13ff22b6a8 Fix AI Search follow-up question closing search (#3585) 2025-08-22 14:51:21 +02:00
Samy Pessé 8927e8fbbb Embeddable Docs Assistant (#3572)
Co-authored-by: Zeno Kapitein <zeno@gitbook.io>
2025-08-22 09:44:51 +02:00
Samy Pessé 25e2b40d47 Update icons to latest version (#3582) 2025-08-21 15:31:13 +02:00
Zeno Kapitein a60af8ff9c Simplify tooltip implementation, add HoverCard (#3580) 2025-08-21 11:14:08 +02:00
Zeno Kapitein 27b328cfd7 Fix pageaside height on pages with hero cover (#3581)
Co-authored-by: Claire Chabas <claire.chabas@gmail.com>
2025-08-21 10:58:13 +02:00
conico974 fa6ef0c01c Remove motion animations from ScrollSectionList (#3573)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-20 19:14:01 +02:00
Zeno Kapitein 6217a2ed3b Page outline: scroll to active item (#3578) 2025-08-20 15:55:16 +02:00
Zeno Kapitein ffa866cb99 Fixes to search modal (#3577) 2025-08-20 10:50:58 +00:00
Zeno Kapitein 011aa931cf Integration tools styling (#3575)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-08-20 09:48:55 +00:00
Taran Vohra 68308154b5 Register custom assistant (#3569)
Co-authored-by: Zeno Kapitein <zeno@gitbook.io>
2025-08-19 12:07:47 +02:00
Zeno Kapitein 36af03f4d5 Pageaside fixes (#3567) 2025-08-18 18:50:00 +02:00
Samy Pessé cbc71a56b6 API to let integrations define custom tools for Docs Assistant (#3568) 2025-08-17 10:03:54 +02:00
Zeno Kapitein 1420180220 Assistant: Prevent sending queries multiple times (#3565) 2025-08-15 08:44:31 +02:00
Zeno Kapitein e1b2cf6d81 Fix page outline scroll (#3563) 2025-08-14 17:52:56 +02:00
conico974 c0e9c49679 Optimize cache retrieval performance and reduce costs on 2C (#3542)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-14 09:14:40 +02:00
conico974 afc4bd4415 Improve image resizing logic in fetchImage function (#3553)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-13 15:35:14 +02:00
Zeno Kapitein bcfa8d8b19 Improve vertical alignment of site items and fix floating page aside (#3560) 2025-08-13 14:36:07 +02:00
Zeno Kapitein 43766d6519 Fix custom logo not rendering on the published site (#3557) 2025-08-13 14:29:49 +02:00
Greg Bergé 42c17f5c74 Improve OpenAPI parsing errors (#3555) 2025-08-13 13:38:14 +02:00
Greg Bergé d655d3eece Support "objectivec" as alias for Objective C syntax (#3556) 2025-08-13 13:37:06 +02:00
conico974 3500de95e8 Never follow redirect in the middleware (#3552)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-13 12:58:43 +02:00
Taran Vohra 7f03b94949 Fix an issue where recommended questions werent using the current siteSpace context (#3559) 2025-08-13 11:06:05 +05:30
Zeno Kapitein f0cf060191 Disable AI Search tests for now (#3561) 2025-08-12 22:12:51 +02:00
Zeno Kapitein 5a137e7b14 Always show placeholder while generating (#3554) 2025-08-12 15:43:29 +02:00
conico974 28f7fbaa8a Fix image format handling and enhance PageCoverImage component (#3527)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-08 18:30:00 +02:00
Nolann B. ff96bb5787 Support new coverDefinitionDark for cards & image type (#3547) 2025-08-08 18:08:11 +02:00
conico974 87841124e0 Add HashContext and HashProvider for managing URL hash state (#3541)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-08 17:01:21 +02:00
conico974 a650b58276 feat: add tracing to server actions (#3543)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-08 16:10:06 +02:00
Zeno Kapitein 388b20d44f Clear AI chat stream properly (#3544) 2025-08-07 19:07:25 +02:00
Claire Chabas ea7e94fc51 Fix search bar layout shit caused by the ToC (#3545) 2025-08-07 15:19:20 +02:00
Zeno Kapitein d30bcbabdb Improve Button and ButtonGroup styling (#3540) 2025-08-06 16:10:55 +02:00
Zeno Kapitein fb858a1941 Tweaks to AIChatButton and AIChatInput (#3539) 2025-08-06 16:10:05 +02:00
Samy Pessé cc2e615b9a Emit a <link rel="alternate"> for the markdown version of a page (#3528) 2025-08-06 08:55:02 +02:00
Samy Pessé a862cde6b4 Use new API to fetch the reusable content document (#3536) 2025-08-06 08:54:43 +02:00
Zeno Kapitein e2b7bec162 Add linewrap to AI actions dropdown (#3534) 2025-08-05 12:17:00 +00:00
Zeno Kapitein c1b577ecc9 Updates to RU translation (#3532) 2025-08-05 14:10:45 +02:00
Zeno Kapitein ba7ec14f76 Fix z-index of search highlight (#3533) 2025-08-05 14:08:46 +02:00
Zeno Kapitein 9f0117723c Add russian translation (#3531) 2025-08-05 12:52:30 +02:00
conico974 f72b6a20db Validate 'next-action' header format in server action requests (#3523)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-05 11:31:43 +02:00
conico974 2f798209bb Bump OpenNext to 1.6.4 (#3520)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-05 11:18:56 +02:00
conico974 eec8f16424 Increase timeout for search answer visibility check (#3530)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-08-05 11:18:12 +02:00
Samy Pessé 885264f132 Version Packages (#3506)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-05 11:03:50 +02:00
Greg Bergé f1a6dec951 Less strict OpenAPI parser (#3529)
Co-authored-by: Nolann Biron <biron.nolann@gmail.com>
2025-08-05 08:45:45 +00:00
Claire Chabas 44f41510fa Fix close buttons tooltips (#3525) 2025-08-04 15:22:59 +02:00
spastorelli f220229e5e Fix stepper title misalignment (#3524) 2025-08-04 09:34:22 +02:00
Greg Bergé 61b4cb8d7c Upgrade Argos (#3522) 2025-08-01 16:07:35 +02:00
Greg Bergé 185cdb4883 Fix scrolling to anchor positionning (#3521) 2025-08-01 15:44:27 +02:00
Zeno Kapitein 2cdba53451 Upgrade to Tailwind v4 (#3206) 2025-08-01 13:03:44 +02:00
Greg Bergé 950f6c36cf greg/rnd 6997 fix long openapi responses label (#3518) 2025-07-31 12:08:57 +00:00
Zeno Kapitein ea37977b1e Fix inconsistent state between q= and ask= and keyboard navigation (#3519) 2025-07-31 13:20:27 +02:00
Greg Bergé 81da82aed7 Increase tests max duration (#3517) 2025-07-30 18:33:56 +00:00
Greg Bergé 39a3518651 Show a HoverCard when an internal link is broken (#3516) 2025-07-30 18:09:57 +02:00
spastorelli d903273759 Strip visitor.* param when normalizing URL (#3512) 2025-07-30 17:22:09 +02:00
Taran Vohra d130532f69 Suggest questions in the current space context (#3514) 2025-07-30 20:36:40 +05:30
Zeno Kapitein 94fcd21f34 Improve ?ask= init handling (#3513) 2025-07-30 13:17:15 +02:00
conico974 1d2db4ae2b Fix cookie handling for AI assistant server actions (#3509)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-30 12:29:51 +02:00
Steven H d270b4af9b Don't track events if a special middleware header is set. (#3511) 2025-07-30 09:26:01 +01:00
Zeno Kapitein ccfbd3c1a8 Fix AI Search Query (#3510) 2025-07-30 07:44:37 +00:00
Claire Chabas 5c4923557f Temporarily remove highlighting for PowerShell and C++ in Safari to avoid page crash (#3508) 2025-07-29 20:39:26 +02:00
Zeno Kapitein b1f608b865 Implement basic URL scheme for Assistant & AI Search (#3503) 2025-07-29 16:13:44 +02:00
conico974 c7993756dd Fix regional caching of tag cache (#3504)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-29 13:27:56 +02:00
Nolann B. d02465823f Prevent page breaks inside blocks when printing (#3507) 2025-07-28 18:08:08 +02:00
Greg Bergé 6b9f6b5b79 Improve french translations (#3501) 2025-07-28 14:05:04 +02:00
Taran Vohra df7de8fb0c Fix an issue where links were not rendering properly in Ask AI answers (#3505) 2025-07-28 16:43:18 +05:30
Samy Pessé 72f5ce3985 Version Packages (#3480)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-24 13:20:46 +02:00
conico974 04c80262e2 Make sure to use the correct version for adaptive content (#3487)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-24 11:40:12 +02:00
Valentino Hudhra 56d1b8fe2d Fix overflowing recommended follow up questions in assistant (#3502) 2025-07-24 11:03:04 +02:00
Zeno Kapitein 054a1634ab Improve AI Actions dropdown (#3499) 2025-07-24 10:40:13 +02:00
conico974 6ff63f2db6 Don't throw on >500 API error (#3500)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-24 09:41:47 +02:00
Greg Bergé b5ad0ce1e5 Fix OpenAPI v2 parsing (#3498) 2025-07-23 17:21:05 +02:00
Claire Chabas 2ba7e54c81 Fix headings styles in hint block (#3497) 2025-07-23 15:46:44 +02:00
Zeno Kapitein 0a858e74ad Fix React warning (#3496) 2025-07-23 10:56:12 +02:00
Zeno Kapitein b0c534fc2c Tweaks to AI Chat and AI Actions Dropdown (#3495) 2025-07-22 19:18:35 +02:00
Steven H 250c194a02 Add nosnippet to announcement banner. (#3490) 2025-07-22 15:03:35 +01:00
Zeno Kapitein 5b10cde936 Fix background corners showing through Powered through GitBook badge (#3493) 2025-07-22 15:15:38 +02:00
Zeno Kapitein 4aeb81bfa5 Fix search input styling & text cutoff (#3491) 2025-07-22 14:58:20 +02:00
conico974 955cebf944 Add cache tags for fetchFileSystem (#3489)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-22 13:41:31 +02:00
Greg Bergé 7c951ef437 Support new colors in text formatting (#3492) 2025-07-22 13:40:03 +02:00
Brett Jephson 68f0dbcc35 RND-7464: confirm in content kit button (#3488) 2025-07-22 10:51:25 +01:00
Zeno Kapitein 39c4f76aea Add fullwidth page option (#3344) 2025-07-21 11:20:17 +02:00
Zeno Kapitein 2fe58e8cbb Page actions customisation (#3485)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-07-18 21:10:38 +02:00
Zeno Kapitein 765141a4d8 Make "last updated" section optional (#3486) 2025-07-18 18:46:11 +00:00
Zeno Kapitein eb1bd3aa01 AI response feedback buttons (#3482) 2025-07-18 15:40:04 +00:00
Zeno Kapitein b7284b0223 Small tweaks to assistant styling (#3481) 2025-07-17 14:31:53 +00:00
conico974 5bbd254742 Support webp and avif formats for og image (#3478)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-17 11:36:07 +02:00
Nolann B. 611e28626a Remove padding on first Heading in Columns (#3479) 2025-07-16 12:51:37 +02:00
Samy Pessé 2a3bb0eb22 Version Packages (#3453)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-15 17:40:24 +02:00
conico974 6816f0fa5a Add browserslist and improve CSS masks for compatibility (#3471)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-15 17:15:56 +02:00
Greg Bergé 17386776ec Add missing changeset to release @gitbook/openapi-parser (#3477) 2025-07-15 12:01:40 +00:00
Nolann B. 9ee9082614 Improvement for CopyMarkdown action (#3465) 2025-07-15 13:41:25 +02:00
Nolann B. 334cfdd522 Fix responsive class for SearchInput button (#3476) 2025-07-15 12:50:57 +02:00
Greg Bergé 8c961a5dbd Fix OpenAPI spec validation (#3473) 2025-07-15 08:56:08 +02:00
conico974 4708956e77 Ensure schema.security is always an array (#3472)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-14 22:01:06 +02:00
Zeno Kapitein 813dd03dbb Fix AIChatInput focus & styling (#3470)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-07-14 11:48:34 +01:00
conico974 0522dbc61e Handle markdown errors gracefully (#3468)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-11 19:11:09 +02:00
Zeno Kapitein acb9f53156 Inline search modal (#3416) 2025-07-11 16:29:03 +01:00
conico974 6016846156 Add cache life inference from API response headers (#3467)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-11 17:10:00 +02:00
Greg Bergé cf1fae5837 Fix using CMD or CTRL to open in a new tab (#3466) 2025-07-11 14:25:37 +00:00
Nolann B. 7212345466 Fix AI Actions dropdown and LLM integration (#3464) 2025-07-11 12:14:06 +02:00
conico974 e38caf78ff Implement consistent logging across the application (#3368)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-11 10:36:03 +02:00
Greg Bergé 0a8dd67541 Better aria for breadcrumbs (#3461) 2025-07-11 09:45:14 +02:00
Nolann B. ed684c19a9 Move AI Actions markdown fetching to client-side (#3459) 2025-07-10 16:05:53 +02:00
Zeno Kapitein 52ab3681e3 Reposition AI Actions dropdown (#3460) 2025-07-09 14:38:23 +00:00
Zeno Kapitein 9cc5a787e9 Generalise keyboard shortcuts, add Cmd+J to AI Chat (#3457) 2025-07-09 12:13:36 +00:00
Nolann B. 0003030bf5 Implement AI actions dropdown (#3431) 2025-07-08 23:33:36 +02:00
Zeno Kapitein 9ad8f45d38 Rebrand assistant (#3458) 2025-07-08 21:31:14 +02:00
conico974 a3855257c8 Gracefully handle OpenAPI fetch errors (#3455)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-08 17:35:23 +02:00
conico974 9169c2f053 Fix site redirect resolution with length check for source paths (#3454)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-08 17:15:57 +02:00
Greg Bergé abe028bd38 Fix Link behaviour reloading the page (#3456) 2025-07-08 14:30:12 +00:00
conico974 12c2451f4f Bump OpenNext to latest versions (#3451)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-08 15:06:23 +02:00
Samy Pessé 8daede5427 Ensure all content links are resolved relatively to preview (#3450) 2025-07-08 13:05:31 +02:00
Samy Pessé 4c89aa60eb Adapt cache header parsing to support s-maxage (#3452) 2025-07-08 12:55:00 +02:00
Greg Bergé d0a3f64ae4 Always open header logo link in the current tab (#3445) 2025-07-08 09:02:49 +00:00
Samy Pessé 433d66482d Version Packages (#3446)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-08 11:01:57 +02:00
Greg Bergé bd553bcf9e Expose isJson and isYaml in @gitbook/openapi-parser (#3447) 2025-07-08 10:41:46 +02:00
Nolann B. f5894bcf74 Fix incorrect revision ID in Markdown fetch logic (#3448) 2025-07-08 09:41:12 +02:00
Zeno Kapitein 1b59e7ce36 Styling improvements to AI Chat Followup questions (#3444) 2025-07-07 19:02:01 +02:00
Samy Pessé 32d6f5845d Version Packages (#3247)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-07 12:49:53 +00:00
Greg Bergé 4f5cbfe732 Upgrade @scalar/openapi-parser (#3442) 2025-07-07 14:33:40 +02:00
Steven H afba8fcb34 Rating columns in tables now use a solid icons instead of unfilled. (#3434) 2025-07-07 10:05:45 +01:00
conico974 377a4899e4 Adjust cache life for error responses (#3423)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-07 09:38:48 +02:00
Greg Bergé 938bdeb34b Fix visual tests (#3440) 2025-07-06 09:02:31 +02:00
Greg Bergé d216eaa3f6 Upgrade Argos & disable bad plugin (#3438) 2025-07-05 21:37:20 +02:00
conico974 5ca5da0f21 Fix handling of bad requests to prevent unnecessary 500 errors (#3432)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-04 17:06:37 +02:00
Greg Bergé ebe6eb3b39 Support custom monospace fonts (#3430) 2025-07-04 13:13:36 +00:00
Zeno Kapitein 3bfe347096 Show section tabs when there is a single section group present (#3387) 2025-07-04 14:55:40 +02:00
Samy Pessé 7b38f89078 Update API client and condition for AI assistant (#3429) 2025-07-03 20:34:26 +02:00
Greg Bergé 09b689b0ea Fix table display in print (#3428) 2025-07-03 17:44:55 +02:00
Nolann B. 2350baa75f Support for OpenAPI Array request body (#3420) 2025-07-03 17:18:26 +02:00
Nolann B. bc1eca815e Error handling for AI chat (#3411) 2025-07-03 14:26:40 +02:00
conico974 78c10340e7 Increase max line length for code highlighting (#3415)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-03 13:05:42 +02:00
Valentino Hudhra c16890a3a6 Align README with CONTRIBUTING guides regarding bun version (#3427) 2025-07-03 12:40:08 +02:00
Addison 3b4fe2827a Update community ad on sponsored/community sites (#3421) 2025-07-03 11:03:16 +02:00
Samy Pessé 7e807aabb5 Don't prevent sending message in AI chat when loading followup suggestions (#3426) 2025-07-03 10:16:42 +02:00
Samy Pessé 973c74ee69 Adapt AI assistant to upcoming API changes (#3422) 2025-07-02 20:58:23 +02:00
Zeno Kapitein efed0b0617 Turn on Docs Assistant for another site (#3425) 2025-07-02 18:02:12 +02:00
Zeno Kapitein ca3b9aca5d Improve AI Chat context popup (#3424) 2025-07-02 18:01:24 +02:00
Taran Vohra e2afc07ab2 Fix resolution of page by resolving site redirects before space redirects (#3414) 2025-07-02 17:30:18 +05:30
Brett Jephson e8fb84d362 Remove flip hash from columns (#3413) 2025-07-02 09:41:53 +01:00
Samy Pessé 57f951a7d9 Remove AI page link summaries (#3418) 2025-07-02 08:40:55 +02:00
conico974 28008667ed Make Emoji component synchronous (#3417)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-07-01 17:10:16 +02:00
Samy Pessé f3affc3034 Add support for MCP tools (#3410) 2025-07-01 09:58:59 +02:00
conico974 59da30f3c6 Add support for cover image repositioning (#3404)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-30 19:07:48 +02:00
Greg Bergé 2db721112a Fix OpenAPI error (#3408) 2025-06-30 15:56:22 +00:00
Samy Pessé b60039b7d5 Fix links to other spaces in a section (#3409)
Co-authored-by: Steven H <steven@gitbook.io>
2025-06-30 17:47:23 +02:00
Steven H 8fe9c9afea Fix an issue where same-site references across spaces created invalid links. (#3407) 2025-06-30 16:03:27 +01:00
Zeno Kapitein 216ba7a556 Add analytics on AI chat (#3405) 2025-06-30 08:41:12 +00:00
Samy Pessé a2ff57081b Fix changesets 2025-06-29 10:41:30 +02:00
Zeno Kapitein 40dbd9a14b AI Chat followup (#3403) 2025-06-28 17:55:56 +02:00
Nolann B. e5bac69c5c Fix markdown page generation for groups (#3402) 2025-06-27 23:32:35 +02:00
Zeno Kapitein 8d6598393f AI Chat UI (#3397)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-06-27 17:43:14 +02:00
Greg Bergé 59b86eb9dc Correctly handle OpenAPI errors (#3401) 2025-06-27 11:15:21 +02:00
Steven H 52c9f6da2f Fix an issue with link resolution in cross-space reusable content. (#3392)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-06-27 11:14:38 +02:00
Nolann B. dd65987c94 Include page group children under the .md route (#3400) 2025-06-27 09:53:18 +02:00
conico974 ace61901a4 Fix ScrollSectionsList with suspended component (#3390)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-26 15:37:51 +02:00
conico974 e6c3c7635d refactor toc components to client (#3394)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-06-26 11:35:02 +02:00
conico974 5134d9e7f8 Avoid unnecessary proxy URL lookups (#3377)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-25 17:21:09 +02:00
conico974 6821fb2937 Downgrade esbuild to fix wrangler dev issues (#3396)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-25 16:50:09 +02:00
Taran Vohra cfe4812045 Replace all usage of getPublishedContentByUrl (#3395) 2025-06-25 18:55:02 +05:30
Samy Pessé 14843ac343 Fix changesets (#3393) 2025-06-25 14:42:49 +02:00
Samy Pessé 8fb6d7465f Remove v1 and replace by v2 (#3391)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-25 13:28:04 +02:00
Samy Pessé 0ef647586f Hooks and APIs for AI v2 (#3385) 2025-06-25 09:48:28 +02:00
Nolann B. b4039627d9 Handle nullish OpenAPI mediaTypeObject (#3389) 2025-06-24 17:25:38 +00:00
Addison 4a295e6db4 Update contributing guide (#3381) 2025-06-24 17:55:24 +02:00
Greg Bergé 5726999a5a Fix viewing a page from a revision (#3388) 2025-06-24 15:31:06 +00:00
conico974 58d7f3c140 Fix revision ID handling for computed content (#3386)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-24 15:00:33 +02:00
Samy Pessé 07eab986d5 Optimize fetching of revisions (#3382) 2025-06-23 19:15:17 +02:00
Samy Pessé 711cf38f9b Use getRevision in getRevisionFile (#3379) 2025-06-23 18:43:41 +02:00
Zeno Kapitein 4f7c0eea9f Clicking an active TOC item toggles its descendants (#3378) 2025-06-23 17:27:34 +02:00
conico974 f3448de2da Improve efficiency of the queue (#3373)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-23 15:09:29 +02:00
Viktor Renkema ec92075ef8 Set tw classes correctly for horizontal alignment in tables (#3375) 2025-06-23 14:35:32 +02:00
Nolann B. 1e013cd87c Optional label in OpenAPI x-codeSamples (#3376) 2025-06-23 13:54:15 +02:00
Samy Pessé f033734308 Support for site customization option to change how external links open (#3372) 2025-06-22 15:49:15 +02:00
Nolann B. 50c05164f7 Bump @scalar/api-client-react (#3371) 2025-06-22 12:03:10 +02:00
conico974 7fb9004b43 Properly redirect to the root page (#3369)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-20 19:15:21 +02:00
Greg Bergé 4721403986 Hide scrollbar on sections (#3367) 2025-06-20 12:31:18 +00:00
Samy Pessé df848ef64e Icon in buttons and text alignment (#3365) 2025-06-20 12:08:28 +02:00
conico974 0b40ccd286 Remove buildId from composable cache key generation (#3366)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-20 12:06:44 +02:00
Greg Bergé caaa692f0b Allow to zoom image on mobile if relevant (#3364) 2025-06-20 10:25:58 +02:00
Greg Bergé 42d43e09c4 Always show scrollbars (#3363) 2025-06-20 08:41:21 +02:00
Samy Pessé 7ccbf55ba7 Set myself as codeowner for data cache (#3355) 2025-06-20 08:41:02 +02:00
conico974 81f5bfc2f9 Filter out malicious request (#3357)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-19 17:00:37 +02:00
Greg Bergé a7a713bca2 Scroll to active TOC when clicking a link (#3362) 2025-06-19 16:50:13 +02:00
conico974 d6613c787f Make skeletons client component (#3361)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-19 16:46:31 +02:00
Greg Bergé 427f748e1c Add metadata for adding site to Apple devices home (#3360) 2025-06-19 16:35:07 +02:00
Greg Bergé 4f5fec7213 Fix CodeBlock rendering (#3359) 2025-06-19 15:55:19 +02:00
Greg Bergé 8c0a53ab40 Fix page group not expanded by default (#3358) 2025-06-19 15:08:59 +02:00
conico974 2dfd5aab20 Update SpacesDropdown to manage active state based on current space (#3356)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-19 13:39:59 +02:00
conico974 8d3c6562a2 Implement a StylesProvider (#3352)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-18 19:02:32 +02:00
Zeno Kapitein dae019c115 Consistently show variant selector in section bar if site has sections (#3349) 2025-06-18 17:48:49 +02:00
Steven H 73e0cbb2d6 Fix an issue where PDF export URLs were not bringing their query params. (#3351) 2025-06-18 13:26:20 +01:00
Steven H 392f59450c Improve performance of InlineLinkTooltip (#3339) 2025-06-18 12:15:45 +01:00
conico974 b4918f60ce fix variant space change when pathname equals space-path (#3343)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-17 22:31:32 +02:00
Samy Pessé 8f7c304d58 Fix crash when rendering ogimage with invalid icon (#3348) 2025-06-17 20:25:21 +02:00
Samy Pessé a3a944d7dd Fix crash during rendering of ogimage for VA sites with default icon (#3347) 2025-06-17 19:38:47 +02:00
Samy Pessé 88a35ed057 Fix crash when integration is triggering invalid requests (#3346) 2025-06-17 19:23:52 +02:00
Samy Pessé 67998b6f15 Fix ogimage generation failing with some JPEG images (#3345) 2025-06-17 19:10:15 +02:00
Samy Pessé ff6d1150a5 Use getRevisionPageDocument on v2 (#3342) 2025-06-17 16:12:58 +02:00
Samy Pessé 500c8cb649 Don't crash ogimage generation on RTL text (#3341) 2025-06-17 13:04:50 +02:00
Samy Pessé 6859f7d239 Fix rendering of ogimage when logo or icon are AVIF images (#3336)
Co-authored-by: Steven H <steven@gitbook.io>
2025-06-17 00:31:07 +02:00
Samy Pessé dfa8a37be1 Don't cache unexpected API errors for more than a few minutes (#3334) 2025-06-17 00:16:52 +02:00
Samy Pessé 11a6511b7a Fix crash when integration script fails to render block (#3332) 2025-06-16 20:06:33 +02:00
Samy Pessé af98402655 Add support for inline icons (#3329) 2025-06-16 19:15:22 +02:00
Samy Pessé b7a0db3339 Fix rendering of ogimage with SVG logos (#3328) 2025-06-16 16:59:54 +02:00
Greg Bergé 382a19885b Hide empty section groups (#3327) 2025-06-16 13:52:42 +00:00
Utku Ufuk d99da6a3ae Ignore case while pattern-matching to highlight search results (#3326) 2025-06-16 12:33:00 +00:00
Samy Pessé 72cd0e59e6 Replace withoutConcurrency by a smarter React.cache (#3325) 2025-06-16 13:37:45 +02:00
Utku Ufuk 42d88da73c Fix UX issue about highlighting the search term in search result sections (#3323) 2025-06-16 13:31:15 +03:00
Taran Vohra 2863fe0dc1 Use resolvePublishedContentByUrl instead of the deprecated resolution endpoint (#3310) 2025-06-16 09:59:55 +05:30
conico974 87218062be Use Promise.all whenever possible (#3319)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-14 11:10:26 +02:00
Samy Pessé 8a3910e208 Experiment with hiding sections without a matching site space (#3318) 2025-06-13 15:55:04 +02:00
conico974 6294bbb53c Fix error propagating (#3317)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-13 15:46:37 +02:00
Zeno Kapitein a28a997851 Add margin to adjacent buttons (#3316) 2025-06-13 15:42:00 +02:00
spastorelli 28a9ee701e Add paypal.gitbook.com to ADAPTIVE_CONTENT_HOSTS list (#3315) 2025-06-13 10:10:10 +00:00
Samy Pessé 50e8b2ec52 Don't use next/server after (#3314) 2025-06-13 11:30:18 +02:00
Samy Pessé 315717fa2d Disable the background fetch of getRevisionPageDocument (#3313) 2025-06-13 11:17:33 +02:00
Samy Pessé da67711c90 Fix crash on Vercel (#3311) 2025-06-12 23:37:38 +02:00
Samy Pessé fecdbe8dde Support dynamic expressions (#3295) 2025-06-12 12:25:28 +02:00
Nolann B. 9316ccd1f4 Update Models page styling (#3307) 2025-06-12 10:57:37 +02:00
Samy Pessé c3b620e975 Preserve current variant when navigating between sections (#3306) 2025-06-12 09:30:08 +02:00
Nolann B. 7a00880e5b Improve support for OAuth2 security type (#3304) 2025-06-11 15:34:52 +02:00
Zeno Kapitein b6b597564d Reverse order of feedback smileys (#3300) 2025-06-11 14:44:07 +02:00
spastorelli d410381957 Add docs.testgitbook.com to ADAPTIVE_CONTENT_HOSTS list (#3303) 2025-06-11 14:25:05 +02:00
conico974 902c3c6c1a apply customization for dynamic site context in v2 (#3302)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-11 14:05:30 +02:00
Zeno Kapitein 4fb2a4a6d7 Rework full-width layout, add support for full-width page option (#3293)
Co-authored-by: conico974 <nicodorseuil@yahoo.fr>
2025-06-11 14:03:45 +02:00
conico974 2d64c78787 return null for 404 cached page in the incremental cache (#3296)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-11 13:47:34 +02:00
Samy Pessé fbfcca5dae Fix rendering of font in ogimage (#3299) 2025-06-11 13:41:26 +02:00
Greg Bergé 664ae8bff6 Make heading from stepper visible in outline (#3301) 2025-06-11 13:40:59 +02:00
Samy Pessé fa3d2aae08 Fix inline expression crashing pages (#3297) 2025-06-11 12:27:24 +02:00
Zeno Kapitein e7a591d9f6 Fix border being added to cards (#3294) 2025-06-10 17:25:29 +00:00
conico974 2860beacdc revert to use withoutConcurrentExecution (#3292)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-10 19:05:07 +02:00
Zeno Kapitein 231167d3e1 Make icons for page groups more contrasting (#3286) 2025-06-10 17:48:06 +02:00
Brett Jephson c0ee60ec13 RND-6843: columns block (#3257)
Co-authored-by: Steven Hall <steven@gitbook.io>
2025-06-09 11:37:56 +01:00
conico974 f58b904ba6 Encode customization header (#3289)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-09 11:37:29 +02:00
conico974 d5992f1a5c Bump OpenNext to latest (#3288)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-09 10:40:44 +02:00
Samy Pessé fa12f9eeb6 Page cover dark-mode specific (#3287) 2025-06-08 14:57:50 +02:00
Samy Pessé 33726c88a0 Generate a llms-full version of the docs (#3285) 2025-06-08 12:13:14 +02:00
Zeno Kapitein 6aa3ff9c5e Fix various styling issues (#3283) 2025-06-08 00:38:41 +01:00
Zeno Kapitein 7d3fe23195 Add circular corners and depth styles (#3280)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-06-07 13:48:16 +02:00
Samy Pessé 521052d84f Remove withoutConcurrentExecution and withCacheKey (#3281) 2025-06-05 20:43:15 +01:00
Samy Pessé c730845e17 Fix missing title for button to close announcement banner (#3279) 2025-06-04 16:33:01 +01:00
Addison 7b5a3616c4 Add UTM tags to the preview site badge (#3277) 2025-06-03 16:07:55 +01:00
Zeno Kapitein c9373efdb5 Fix bold header links hover color (#3255) 2025-06-03 15:18:04 +02:00
Brett Jephson 015615de8a fix: defaultWidth/fullWidth options in images (#3274) 2025-06-03 12:18:01 +01:00
conico974 0f867e533a bump OpenNext to latest (#3276)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-02 17:40:04 +02:00
conico974 7d5a6d2255 Fix hydration error on V2 (#3272)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-06-02 14:23:15 +01:00
conico974 a1da4f023d Move DO to a 3rd worker (#3270)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-30 16:19:11 +02:00
conico974 666e8426e1 External middleware in cloudflare (#3254)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-30 14:56:00 +02:00
conico974 df2fa42bda Chores: create server worker (#3265)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-30 14:31:21 +02:00
conico974 b3a7ad6d2c Fix href being empty in TOC (#3269)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-28 17:07:33 +02:00
conico974 2932077bf9 Remove trailing slash from linker (#3268)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-27 21:13:55 +02:00
Nolann B. 957afd967f Add authorization header for OAuth2 (#3266) 2025-05-26 20:54:07 +02:00
Nolann B. 4c9a9d0416 Handle nested deprecated properties in generateSchemaExample (#3267) 2025-05-26 20:28:26 +02:00
Nolann B. 40df91a363 Deduplicate path parameters from OpenAPI spec (#3264) 2025-05-26 18:55:11 +02:00
conico974 af66ff71ed Add a force-revalidate api route (#3263)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-25 16:55:45 +02:00
Samy Pessé 6f8ecd6111 Use more strict context ID for images during preview (#3261) 2025-05-23 13:16:43 +02:00
conico974 fa3eb07617 Cache fonts and static image in memory for OG Image (#3258)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-23 10:20:07 +02:00
Samy Pessé dc4268db64 Compute correct urls for variants/sections when previewing unpublished site (#3259) 2025-05-23 10:01:15 +02:00
Nolann B. a0c06a72cc Indent JSON python code sample (#3260) 2025-05-23 09:13:20 +02:00
conico974 19c20c0be3 Fix OGImage icon fetch on cloudflare (#3253)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-21 15:39:52 +02:00
Viktor Renkema fae34e56ac Calculate class more explicitly & separately to fix horizontal table cell alignment issue (#3252) 2025-05-21 14:20:39 +02:00
conico974 ba0094a862 fix ISR in preview in cloudflare (#3250)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-21 09:52:05 +02:00
conico974 b259009c9c Add temporary logging for Cloudflare debugging (#3249)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-20 19:33:33 +02:00
conico974 d88dd5ed8a Update OpenNext (#3248)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-20 19:04:07 +02:00
Zeno Kapitein 57bb146075 Dynamic TOC height (#3233) 2025-05-20 14:13:57 +02:00
Zeno Kapitein 4b67fe5317 V2: Add urlObject.hash to linker.toLinkForContent (#3246) 2025-05-20 10:25:35 +02:00
Samy Pessé 938125e772 Version Packages (#3180)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-19 19:10:57 +02:00
conico974 1c8d9febb3 Custom Incremental Cache (#3239)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-19 17:00:09 +02:00
conico974 223edae17d Add env variables for the DOQueue (#3243)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-19 13:47:33 +02:00
Nolann B. 12a455dab5 Fix OpenAPI layout issues (#3242) 2025-05-18 14:50:05 +02:00
Nolann B. d00dc8ca72 Pass spec validation errors through OpenAPIParseError (#3240) 2025-05-18 13:20:17 +02:00
Samy Pessé 2c85a302fc Update opennext and leverage "use cache" on CF (#3204)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
2025-05-16 13:58:35 +01:00
Addison 3460b78b45 Update docs.gitbook.com to gitbook.com/docs (#3187)
Co-authored-by: Tal Gluck <talagluck@gmail.com>
Co-authored-by: Taran Vohra <taranvohra@outlook.com>
2025-05-16 17:59:53 +05:30
Zeno Kapitein 95a1f652f9 Better print layouts: wrap code blocks & force table column auto-sizing (#3236) 2025-05-15 13:24:10 +02:00
spastorelli cc37e2ae15 Persist visitor params values in public visitor session cookie (#3231) 2025-05-14 14:16:13 +02:00
Claire Chabas 08382ce62f Improve tabs link support (#3211) 2025-05-14 11:10:09 +02:00
Nolann B. 80cb52a237 Handle OpenAPI alternatives from schema.items (#3235) 2025-05-14 08:05:08 +02:00
Nolann B. c6637b09e2 Use default value if string/number/boolean in generateSchemaExample (#3234) 2025-05-13 22:07:41 +02:00
Samy Pessé 778624af00 Only resize images with supported extensions (#3229) 2025-05-13 10:52:58 +02:00
Samy Pessé e15757d01f Use next@15.3.2 instead of canary (#3227) 2025-05-09 15:17:49 +02:00
Zeno Kapitein aed79fd6c3 Remove header logo rounding (#3225) 2025-05-09 14:45:38 +02:00
Greg Bergé 0c973a3292 Always link main logo to the root of the site (#3226) 2025-05-09 10:31:52 +00:00
spastorelli 56c923c0ed Adapt site resolution/lookup to pass visitor unsigned claims in addition to token (#3202)
Co-authored-by: taranvohra <taranvohra@outlook.com>
2025-05-09 15:34:20 +05:30
Samy Pessé 7d7806df30 Passthrough SVG images in image resizing (#3224) 2025-05-08 18:57:50 +02:00
Nolann B. cb5598dc19 Handle invalid OpenAPI Responses (#3223) 2025-05-08 11:54:46 +02:00
Greg Bergé 47f01edcb8 Fix E2E icons (#3222) 2025-05-08 13:04:04 +05:30
Greg Bergé e6ddc0f07f Fix sitemap URLs (#3220) 2025-05-08 08:54:28 +02:00
Zeno Kapitein 373f18f451 Prevent section group popovers from opening on click (#3213) 2025-05-07 13:57:58 +00:00
Taran Vohra 3f292065cd Update site redirect regex for validation (#3216) 2025-05-07 12:42:28 +05:30
Greg Bergé 5e975ab95b Fix code highlighting for HTTP (#3214) 2025-05-06 13:41:15 +00:00
Greg Bergé a3ec264764 Fix Python code sample "null vs None" (#3215) 2025-05-06 15:40:56 +02:00
Samy Pessé 5d504ffa4c Fix resolution of links in reusable content (#3212) 2025-05-06 10:30:55 +02:00
Samy Pessé 04999662db Use absolute URLs in sitemap.xml when pointing to sitemap-pages.xml (#3210) 2025-05-05 09:03:28 +02:00
Zeno Kapitein f7a34706c7 Allow high-contrast input colors to be used as-is (#3209) 2025-05-02 19:41:05 +02:00
Taran Vohra f328a41982 Revert getPublishedContentByUrl timeout back to 10s (#3208) 2025-05-02 11:16:31 +00:00
Nolann B. 20ebecb114 Missing top-level required OpenAPI alternatives (#3207) 2025-05-02 11:48:15 +02:00
Taran Vohra 5a69692f54 Temporarily bump getPublishedContentByUrl timeout to 30s on v1 (#3199) 2025-04-30 19:14:09 +05:30
Nolann B. 42ca7e1580 Fix openapi CR preview (#3197) 2025-04-30 11:44:39 +02:00
Nolann B. c4ebb3fecd Fix openapi-select hover in responses (#3196) 2025-04-30 11:27:03 +02:00
Zeno Kapitein 2a805cc082 Change OpenAPI schema-optional from info to tint color (#3194) 2025-04-29 19:30:11 +02:00
Zeno Kapitein 89a5816ee4 Fix OpenAPI disclosure label ("Show properties") misalignment on mobile (#3193) 2025-04-29 19:29:56 +02:00
Zeno Kapitein c3f6b8c003 Reduce chroma of text layers (#3188) 2025-04-29 19:29:42 +02:00
Zeno Kapitein 0e201d5899 Add border to filled sidebar on gradient theme (#3185) 2025-04-29 19:29:32 +02:00
Zeno Kapitein ae5f1abc58 Change Dropdowns to use Radix's DropdownMenu (#3189) 2025-04-29 18:30:47 +02:00
Nolann B. 580101d04e Schemas disclosure label causing client error (#3192) 2025-04-29 16:16:58 +02:00
Johan Preynat 81b4a4db53 Allow /~gitbook/image and /~gitbook/icon despite querystring parameters for SEO in robots.txt (#3191) 2025-04-28 12:07:34 +02:00
Steven H 8339e91e2b Fix images and other content refs in reusable content across spaces. (#3190) 2025-04-25 15:28:09 +01:00
Steven H 3119066728 Support for reusable content across spaces. (#3173) 2025-04-24 16:54:11 +01:00
Zeno Kapitein 326e28e9b0 Restyle openapi blocks (#3169) 2025-04-24 16:53:29 +02:00
Johan Preynat 90f0127ada Use react@19 on v2 and v1 (#3184) 2025-04-24 16:53:23 +02:00
Viktor Renkema 0353a8186c Have all nodes within a text-cells adhere to alignments (#3175) 2025-04-24 11:43:20 +02:00
Steven H dd043df00f Revert investigation work around URL caches. (#3183) 2025-04-23 16:53:33 +01:00
Steven H 97b7c79bc6 Increase logging around caching behaviour causing page crashes. (#3182) 2025-04-23 15:04:00 +01:00
Steven H 634e0b4302 Improve error messages around undefined site sections. (#3179) 2025-04-23 11:47:28 +00:00
Greg Bergé 2a23f1f003 Improve performances of TOC (#3176) 2025-04-23 09:31:22 +02:00
Samy Pessé 88ffdcc303 Version Packages (#3172)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-22 11:20:21 +02:00
Nolann B. b6b09d42af Fix OpenAPI responses select placement and icon (#3174) 2025-04-22 10:59:42 +02:00
Nolann B. ebc39e9db9 Missing select icon (#3171) 2025-04-18 16:26:59 +02:00
Samy Pessé 0df3849ea2 Version Packages (#3157)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-18 13:40:34 +02:00
Greg Bergé 8ed1bda2f2 Translate OpenAPI blocks (#3166) 2025-04-18 13:29:55 +02:00
Nolann B. d67699a1f1 Add OpenAPI Webhook block (#3160) 2025-04-18 08:35:44 +02:00
Greg Bergé 3363a18856 Merge simple alternatives (#3165) 2025-04-16 09:14:12 +00:00
Amrit Kahlon ad1dc0b914 Bump scalar version (#3161)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-04-15 18:00:07 -07:00
Samy Pessé e4c7307c99 Fix CORS error when loading fonts in 2c (#3163) 2025-04-14 17:05:31 -07:00
Samy Pessé f9c942c8ff Fix CORS error when loading icons in 2c (#3162) 2025-04-14 16:52:39 -07:00
Greg Bergé eeb977fc03 Fix Python JSON code example (#3159) 2025-04-14 19:50:40 +00:00
Greg Bergé 4b8a62122a Show sections tabs only if there is at least two sections (#3158) 2025-04-14 14:09:34 +02:00
Addison e44e947fc1 Update cookie banner to use American English (#3154) 2025-04-14 18:43:01 +09:00
Nolann B. 7588cfe1c5 Improve OpenAPIResponses examples and schemas (#3123) 2025-04-14 11:16:35 +02:00
Greg Bergé a9a643f222 Improve icon stabilization (#3147) 2025-04-13 05:41:47 +00:00
Samy Pessé 77d6cb75be Improve error message when image resizing failed (#3148) 2025-04-12 17:44:23 -07:00
Samy Pessé 1942d221df Bump the cache of getPublishedContentByUrl in v1 (#3146) 2025-04-12 07:18:26 -07:00
Greg Bergé 041601ed65 Upgrade Argos (#3145) 2025-04-12 15:48:51 +02:00
Steven H 5567281a85 Bump getPublishedContentByUrl cache. (#3144) 2025-04-11 17:13:01 +01:00
Samy Pessé 4c3753046b Cloudflare: fix image resizing (#3143) 2025-04-11 16:48:43 +02:00
Samy Pessé 89f8e16184 Cloudflare: resize images in v2 using direct fetch (#3141) 2025-04-11 15:18:44 +02:00
Samy Pessé a3e1125ced Hotfix for v1 crashes (#3139) 2025-04-10 22:00:41 +02:00
Samy Pessé 4dae8acfed Cloudflare: fix image resizing (#3138) 2025-04-10 19:30:15 +02:00
Samy Pessé bc081c4344 Fix cache revalidation for computed revisions (#3134) 2025-04-10 16:36:02 +02:00
Samy Pessé e4275b235d Version Packages (#3137)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-10 13:31:27 +02:00
Samy Pessé 77397cac82 Fix version of @gitbook/api referenced in cache-tags (#3136) 2025-04-10 13:30:28 +02:00
Samy Pessé b6a08bc679 Version Packages (#3084)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-10 13:18:22 +02:00
Samy Pessé 116575c811 Changeset for cache-tags (#3135) 2025-04-10 13:16:01 +02:00
Samy Pessé 4ba7bd5ce1 CF Preview URL: Extract worker URL and run visual tests (#3132) 2025-04-09 18:25:37 +02:00
Samy Pessé 223ab5377f Test cloudflare preview URL (#3130) 2025-04-09 17:24:38 +02:00
Samy Pessé ae43ca146c Fix preview URLs on Cloudflare env (#3129) 2025-04-09 16:00:21 +02:00
Taran Vohra 42342893d6 Fix incoming URL for requests that were proxied (#3127) 2025-04-09 19:10:14 +05:30
Nolann B. eedefdd5c9 Handle optional security headers (#3128) 2025-04-09 15:07:33 +02:00
Samy Pessé f5e152dd74 Fix hovering links in docs.gitbook.com (#3125) 2025-04-09 11:43:12 +02:00
Zeno Kapitein 95ea22d9c5 Cache AI Page Link summary (#3106)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-04-09 09:59:35 +02:00
Taran Vohra f23023ddfa Use the proxy request identifier for storing the VA cookie in proxy sites (#3091) 2025-04-09 12:49:22 +05:30
Samy Pessé da74077954 Remove proxy package (#3124) 2025-04-08 23:58:19 +02:00
Nolann B. 29aaba5949 Override Scalar's overscroll-behavior (#3120) 2025-04-08 19:16:46 +02:00
Zeno Kapitein daf41fc728 Footer design tweaks (#3109) 2025-04-08 18:44:57 +02:00
Zeno Kapitein b08eb1af59 Fix list of variants overflow (#3114) 2025-04-08 18:44:44 +02:00
Zeno Kapitein 8322cd3e35 Fix sections being displayed when there is only 1 (#3113) 2025-04-08 18:44:08 +02:00
Samy Pessé 444039c142 Fix opening of links when v1 is embedded in an iframe (#3122) 2025-04-08 18:43:06 +02:00
Samy Pessé 3b0eff7f71 Fix getRevisionPageByPath in v2 not encoding the path correctly (#3121) 2025-04-08 16:29:08 +00:00
Samy Pessé c765463e38 Fix ogimage generation crashing when site is using a custom WOFF2 font (#3119) 2025-04-08 16:44:28 +02:00
Samy Pessé e8ca25b67e Fix caching in Cloudflare version using R2 as a backend (#3118) 2025-04-08 13:37:07 +02:00
Brett Jephson 528eee3fc6 RND-548: add subscript and superscript support (#3110) 2025-04-08 11:32:12 +01:00
Steven H 168a4fa998 Add support for buttons to GitBook. (#3117) 2025-04-08 09:18:29 +01:00
Samy Pessé 3ea75adba4 Update turbo to 2.5.0 and fix cache config (#3116) 2025-04-08 09:56:05 +02:00
Nolann B. cbd768a095 Improve OpenAPI codesample (#3090) 2025-04-08 09:35:22 +02:00
Samy Pessé 2d01653a78 Fix ogimage on Cloudflare and resizing of ads image (#3107) 2025-04-08 01:29:34 +02:00
Nolann B. aa3357a57d Fix OpenAPISchemas description padding (#3115) 2025-04-07 21:54:33 +02:00
Samy Pessé de53946896 Sanitize the back URL used when rendering PDF (#3111) 2025-04-07 17:03:09 +02:00
Samy Pessé d51204148e Revert debugging of ogimage errors (#3105) 2025-04-06 13:33:48 +01:00
Samy Pessé 319761a39e Fix revalidation not working because of memoization (#3104) 2025-04-06 01:27:22 +02:00
Samy Pessé 7fbf01a348 Update opennext to 1.0.0-beta.0 (#3102) 2025-04-05 23:51:12 +02:00
Steven Hall c22490bd80 Prefer @vercel/og for icon generation. 2025-04-05 09:22:13 +01:00
Steven Hall 860fd6d02e Use system-ui font in icons. 2025-04-05 09:12:20 +01:00
Steven Hall c43c524804 Fix a typing issue using ArrayBuffer.detached 2025-04-05 09:06:17 +01:00
Steven H 66bb938d85 Use Inter font when generating icons to prevent ArrayBuffer re-use. (#3101) 2025-04-05 09:01:41 +01:00
Steven H 0e6d928496 Use Inter font when generating icons to prevent ArrayBuffer re-use. (#3100) 2025-04-05 08:47:56 +01:00
Steven H f07982d9f8 Investigate issue where icons and ogimage would occasionally fail. (#3099) 2025-04-05 08:15:02 +01:00
Steven H b92ecfad58 Implement retry logic for the DO cache to prevent when revalidating content. (#3098) 2025-04-04 23:44:32 +01:00
Zeno Kapitein 416bde70bc Link tooltips + AI link summaries (#3088)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-04-04 20:56:42 +02:00
Steven H 580f7ade15 Better debugging of GitBook v1s revalidate endpoint. (#3097) 2025-04-04 17:36:24 +01:00
Zeno Kapitein cdffd7c47b Desaturate text colours by decreasing chroma for the last steps of the color scale (#3096) 2025-04-04 18:00:01 +02:00
Greg Bergé 5a959cf041 Fix a regression on OpenAPI example bg (#3095) 2025-04-04 15:05:53 +00:00
Zeno Kapitein 31466546a2 Change overlay close icon to close (#3089) 2025-04-04 16:42:47 +02:00
Steven H 90ead98eaa Better error handling in revalidate v1 (#3094) 2025-04-04 14:59:14 +01:00
Samy Pessé 65e9cb9d5c Update next to "canary" for v2 (#3093) 2025-04-04 14:39:43 +02:00
Greg Bergé e59076a074 Improve OpenAPI schemas block ungrouped style (#3092) 2025-04-04 14:28:44 +02:00
Nolann B. 653920dec9 Add tests for generateSchemaExample (#3086) 2025-04-03 19:42:40 +02:00
Greg Bergé 23cedd2d8b Hide deprecated properties in examples (#3085) 2025-04-03 19:40:52 +02:00
Nolann B. 70c4182fd8 Improve OpenAPI schema style (#3079) 2025-04-03 16:10:20 +00:00
Samy Pessé b62b101065 Do not use insights cookie if disabled (#3087) 2025-04-03 17:30:43 +02:00
Zeno Kapitein b9c929beeb Update page breadcrumb color (for links-accent crumbs) (#3082) 2025-04-03 16:34:14 +02:00
Nolann B. 2b6c593289 Remove stable from x-stability (#3083) 2025-04-03 11:33:39 +02:00
Samy Pessé c0b339e406 Version Packages (#3075)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-02 13:36:04 +02:00
Nolann B. da485f5144 Fix read-only in generateSchemaExample (#3069) 2025-04-02 13:03:51 +02:00
Nolann B. 139a8050a5 Fix OpenAPI enum display (#3077) 2025-04-02 10:15:19 +02:00
Nolann B. da7b369ffd Fix missing headers in OpenAPIResponses (#3074) 2025-04-01 21:57:36 +02:00
Samy Pessé 432da64919 Version Packages (#3073)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-01 18:13:52 +02:00
Nolann B. 7d0b422200 Handle grouped OpenAPISchemas (#3071) 2025-04-01 17:24:43 +02:00
Zeno Kapitein fb90eb0acc Limit tinted background on bold theme to sites with filled sidebar (#3072) 2025-04-01 16:43:08 +02:00
Samy Pessé b647538e41 Version Packages (#3033)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-01 16:35:09 +02:00
Samy Pessé e50797a5c1 Adapt new computed content and add tag for translation (#3070) 2025-04-01 15:10:55 +02:00
Nolann B. 5b1e01c786 Support for x-stability property (#3064) 2025-03-31 13:49:37 +02:00
Nolann B. 813b2af06b Support for x-enumDescriptions and x-gitbook-enum (#3066) 2025-03-31 12:18:57 +02:00
Nolann B. 6f71da88d8 Fix padding in OpenAPI schemas (#3067) 2025-03-31 12:03:53 +02:00
Samy Pessé fa91eb7eaf Fix dark mode PDF (#3065) 2025-03-28 18:00:33 +01:00
Zeno Kapitein c756761591 Add breadcrumbs to search results (#2772) 2025-03-28 13:29:05 +01:00
Samy Pessé 434af90366 Fix image resizing when using proxy by passing signing identifier in site URL data (#3063)
Co-authored-by: Taran Vohra <taranvohra@outlook.com>
2025-03-28 12:28:12 +01:00
Valentino Hudhra 0f41e194cb Fix dismissed annoucement banner ignored when switching sites (#3057) 2025-03-28 10:56:18 +01:00
Nolann B. bd353489e9 Fix missing alternative schemas (#3058) 2025-03-28 06:53:28 +01:00
Samy Pessé 77fd393f15 Fix click on search items when embedded in an iframe and track announcement links (#3061) 2025-03-27 20:13:14 +01:00
Taran Vohra 8701b5e078 Use the site canonical URL when rewriting in the middleware (#3060) 2025-03-27 19:39:39 +01:00
Nolann B. 61db166f92 Add OpenAPI write-only indicator (#3059) 2025-03-27 18:21:38 +01:00
Zeno Kapitein 0d9b9cea0f Fix announcement banner margin (#3056) 2025-03-27 15:59:47 +00:00
Nolann B. 7bb37c7f0a Move filterSelectedOpenAPISchemas to @gitbook/openapi-parser (#3054) 2025-03-27 15:53:41 +01:00
Taran Vohra 5b2bf828e3 Use stable site URL data for route rewrite in the middleware (#3053) 2025-03-27 18:26:06 +05:30
Samy Pessé c85d3f9752 Serve a markdown version of the page when adding a .md extension (#3055)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-27 12:35:18 +00:00
Zeno Kapitein 4d7088bbf0 Stop variant selector from growing too large (#3043) 2025-03-27 10:42:18 +01:00
Samy Pessé dd6ab6044c Fix crash when using user mention or accessing invalid change requests (#3051) 2025-03-27 01:04:00 +01:00
Samy Pessé d236bf029c Fix flash for site with dark default mode (#3050) 2025-03-26 18:12:45 +01:00
Zeno Kapitein d70d566abe Support site announcement banner (#3008)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
2025-03-26 16:37:05 +01:00
Nolann B. a25fdedea9 Replace $ref with $reference in json-decycle (#3049) 2025-03-26 14:16:03 +00:00
Nolann B. 373183a2cd Safe parse OpenAPI JSON schema (#3046) 2025-03-26 13:55:22 +01:00
Samy Pessé e9fa50dfb5 Trim search query before doing search (#3042) 2025-03-26 10:18:18 +00:00
Samy Pessé 57ca4e0e88 Fix crash when integration is not installed on the space (#3040) 2025-03-26 10:19:57 +01:00
Samy Pessé bc90adb73a Allow indexation of images to ensure favicons display on Google (#3041) 2025-03-26 10:17:57 +01:00
Nolann B. 1505ddbd5a Fix multiple request examples selector not showing (#3039) 2025-03-25 20:48:57 +01:00
Greg Bergé cd99ed57fb Fix OpenAPI spec rendering (#3037) 2025-03-25 15:13:18 +00:00
Samy Pessé 27de1cd01d Default to the first ID as being active in scroll detection (#3036) 2025-03-25 15:39:45 +01:00
Nolann B. ae78fc5394 Fix XML in code sample (#3030) 2025-03-25 15:11:45 +01:00
Samy Pessé 40e8e69c6d Disallow crawling by web-robots of search/ask URLs (#3035) 2025-03-25 13:51:09 +00:00
Nolann B. e84a46a558 Fix OpenAPI tabs indicator overflow (#3032) 2025-03-25 10:03:58 +01:00
Samy Pessé 18a72d4466 v2: improve caching (#3031) 2025-03-25 09:40:54 +01:00
Zeno Kapitein d7aa5fa003 Remove loading state for recommended questions (#3029) 2025-03-24 19:19:12 +01:00
Samy Pessé 27532a5f41 Version Packages (#2988)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-24 17:43:16 +01:00
Nolann B. 48c18c03b9 Add option to pass scalar plugins (#3027) 2025-03-24 14:11:14 +01:00
Samy Pessé bba2e52e24 Fix support for site redirects that include section/variant paths (#3024) 2025-03-24 10:21:26 +01:00
Valentino Hudhra 54ee0149e1 Add support for custom fonts (#2981) 2025-03-24 08:20:58 +01:00
Greg Bergé 8fda9d2fab Update Argos (#3025) 2025-03-22 23:00:25 +01:00
Samy Pessé 77a72d79ce Update next.js to latest v14 and v15 (#3026) 2025-03-22 20:02:15 +01:00
Nolann B. 73e2b472ef Fix write only properties in request example (#3023) 2025-03-21 19:09:25 +01:00
Samy Pessé 2f28cc1323 v2: improve link and navigation between content in a same site (#3020) 2025-03-21 18:18:34 +01:00
Greg Bergé f5516d4e21 Improve OpenAPI TOC display (#3022) 2025-03-21 14:29:12 +00:00
Greg Bergé d2facb2db1 Mark OpenAPI properties as optional if not required (#3021) 2025-03-21 14:28:53 +00:00
Greg Bergé 6eae764b7c Add support for multiple body content types / examples (#2991) 2025-03-21 14:23:42 +01:00
Greg Bergé 970ef8f886 Add missing token (#3019) 2025-03-21 11:04:57 +01:00
Nolann B. ed0720699e Fix OpenAPI path overflow on mobile (#3018) 2025-03-21 11:02:32 +01:00
Greg Bergé ad94d00d5f Improve markdown parsing (#3017) 2025-03-21 10:53:01 +01:00
Greg Bergé c7843f7f52 Remove bun cache (#3016) 2025-03-21 10:42:57 +01:00
Greg Bergé 1fe3286bdb Fix OpenAPI overflow issue (#3015) 2025-03-21 10:42:09 +01:00
Samy Pessé ce030fdf76 v2: Fix redirect to strip jwt_token in url-host mode (#3014) 2025-03-21 00:46:39 +01:00
Samy Pessé 9ba8783952 v2: Fix the redirection when stripping the jwt_token from url (#3013) 2025-03-21 00:25:34 +01:00
Greg Bergé 2f3966cc53 Fix icons flaky (#3012) 2025-03-20 21:08:46 +00:00
Samy Pessé 8f65a22e13 Accept API token in query parameters for normal v2 routes (#3011) 2025-03-20 19:54:55 +01:00
Greg Bergé 2787d884cd Stabilize images & icons (#3009) 2025-03-20 19:40:42 +01:00
Nolann B. fc00b51683 Remove default value in generateSchemaExample (#3007) 2025-03-20 17:24:23 +01:00
Samy Pessé f80c3a7b37 v2: Fix display of integration blocks (#3010) 2025-03-20 15:56:31 +00:00
Samy Pessé 4e5d6c7487 v2: use static route for VA / adaptive content (#2998) 2025-03-20 15:41:17 +01:00
Greg Bergé 96f84b5917 Fix visual tests v2 (#3006) 2025-03-20 11:34:04 +01:00
Greg Bergé 6b8a5fdd1b Trigger tests (#3005) 2025-03-20 10:00:09 +00:00
Greg Bergé 89083ac790 Stabilize visual tests (#3001) 2025-03-20 09:22:09 +01:00
Nolann B. 70be2c6b2b Stringify default value (#3003) 2025-03-19 21:28:40 +01:00
Samy Pessé bcf877841b Update to latest version of the GitBook API (#3002) 2025-03-19 20:11:44 +01:00
Nolann B. a84b06bb19 Update resolveDescription and add minItems/maxItems (#3000) 2025-03-19 17:21:35 +01:00
Zeno Kapitein 24b7808d9a Fix prominent search bar width on md screens (#2996) 2025-03-19 17:14:07 +01:00
Greg Bergé 8364ee988e Fix Argos flakies (#2999) 2025-03-19 16:04:45 +01:00
Samy Pessé 07f6e2d233 Pass page.computedSeed to getComputedDocument (#2995) 2025-03-19 15:02:49 +01:00
Greg Bergé 7212973f34 Update Scalar client (#2993) 2025-03-18 16:02:40 +01:00
Greg Bergé af44e0436b fix typo (#2992) 2025-03-18 14:20:23 +01:00
Greg Bergé 3f9c35d505 Fix emoji display on other platforms than Mac OS (#2990) 2025-03-17 17:49:13 +01:00
Zeno Kapitein 2c13f8b95c Fix horizontal overscroll issue on large screens (#2989) 2025-03-17 15:38:44 +01:00
Zeno Kapitein 4dab1c56e5 Fix alignment of prominent search bar on full-width pages (#2987) 2025-03-17 15:02:23 +01:00
Zeno Kapitein 4723f03ef1 Restyle section group dropdown (#2985) 2025-03-17 13:22:54 +01:00
Samy Pessé 278689e0a0 Version Packages (#2984)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-17 11:06:18 +01:00
Nolann B. 886e204e68 Update OpenAPI operation path design (#2972) 2025-03-17 10:18:24 +01:00
Greg Bergé c59947ab39 Remove Sentry (#2986) 2025-03-17 09:00:58 +01:00
Zeno Kapitein 4f0a772a21 Override tint lightness if supplied color is out of bounds (#2983) 2025-03-14 18:24:25 +01:00
Samy Pessé 903f962673 Version Packages (#2964)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-14 18:01:38 +01:00
Nolann B. 31d800e48b Changeset for OpenAPI schemas (#2982) 2025-03-14 17:08:21 +01:00
Nolann B. c1c58eb919 Render OpenAPISchemas block (#2959) 2025-03-14 16:24:09 +01:00
Zeno Kapitein eec3eed100 Support prominent search bar style (#2936)
Co-authored-by: Nolann Biron <biron.nolann@gmail.com>
2025-03-14 15:11:21 +01:00
Samy Pessé 99da8df3d1 Resize and optimize ogimage and favicons (#2980) 2025-03-13 18:45:14 +01:00
Steven H c9ea23919e Fix an issue where iframe aspect ratio was not respected. (#2979) 2025-03-13 14:23:50 +00:00
Zeno Kapitein 16292def79 Display sidebar on no-TOC pages (#2942) 2025-03-13 10:28:12 +01:00
Taran Vohra 9108c56ca1 Fix an issue where ContentKit webframes weren't sized properly (#2978) 2025-03-13 13:29:29 +05:30
Samy Pessé b011ea0af8 Simplify deferred codeblock highlighting and fix streaming (#2977) 2025-03-13 00:25:48 +01:00
spastorelli d33171b779 Fix getVisitorAuthCookieMaxAge returning 60s even when token expiry is much later (#2974) 2025-03-12 16:17:16 +01:00
Steven H 6aaeae269e Fix an issue where ContentKit iframes were not resizing. (#2967) 2025-03-12 14:52:27 +00:00
Samy Pessé e5f0cc8663 Respond with all tags of all cache used for page generation (#2973) 2025-03-12 10:30:47 +01:00
Nolann B. 9b5f971aa1 Transparent background for OpenAPI path block (#2963) 2025-03-11 13:32:35 +00:00
Nolann B. ff3b708ad3 Remove read-only properties from codesample (#2965) 2025-03-11 13:32:10 +00:00
Nolann B. e996904013 Update target in shiki javascript engine (#2968) 2025-03-11 14:21:07 +01:00
Samy Pessé f32bf1f15d Use API cache endpoint and service binding in Cloudflare (#2952) 2025-03-11 13:06:06 +01:00
Zeno Kapitein 6cda2dd57b Fix hint hover style (#2966) 2025-03-11 11:00:28 +00:00
Nolann B. c60e9ba27f Handle OpenAPI read-only properties (#2962) 2025-03-11 11:37:11 +01:00
Zeno Kapitein 9bc3d504c8 Info hint background and link color fixes (#2953) 2025-03-11 11:30:28 +01:00
Greg Bergé b5e4fd75e9 Upgrade shiki and bring back support to C/C++ (#2961) 2025-03-11 10:53:51 +01:00
Samy Pessé a92cb49445 Version Packages (#2958)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-11 09:38:39 +00:00
Greg Bergé 88f64b0d63 Support Node.js v20 with @gitbook/icons (#2960) 2025-03-11 09:27:26 +00:00
Nolann B. 844059f9a5 Fix spacing in OpenAPISecurities (#2954) 2025-03-11 09:37:34 +01:00
Nolann B. eaf2d68308 OpenAPI operation title fallback in sections (#2955) 2025-03-11 09:37:00 +01:00
Nolann B. 12bdbf988d Fix react-openapi tests (#2956) 2025-03-11 09:20:24 +01:00
Samy Pessé 29bab79005 v2: PDF export for sites and spaces (#2949) 2025-03-10 00:08:33 +01:00
Samy Pessé 8d5de97ddf v2: fix fallback and VA redirects (#2948) 2025-03-08 11:21:49 +01:00
Samy Pessé d9b5a898ab Version Packages (#2947)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-08 00:29:16 +01:00
Nolann B. f127d28675 Rename OpenAPIModels to OpenAPISchemas (#2946) 2025-03-07 22:28:37 +01:00
Samy Pessé 65c1bdc455 Version Packages (#2945)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-07 19:37:41 +01:00
Samy Pessé 0711a171d4 Fix deployment of 2c to production 2025-03-07 18:26:51 +01:00
Samy Pessé c58c551f9e Simplify envs management for deployments (#2943) 2025-03-07 18:17:44 +01:00
Greg Bergé f574858b9b Fix OpenAPI example (#2944) 2025-03-07 17:54:35 +01:00
Samy Pessé 3e1592e16b Fix configuration for v2 staging (#2940) 2025-03-07 14:46:45 +01:00
Samy Pessé 90604c4c3b Version Packages (#2917)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-07 14:03:59 +01:00
Claire Chabas 9ffc3b606d Fix content overflowing out of their container in lists (#2939) 2025-03-07 11:19:02 +01:00
Samy Pessé e00c87d3e6 Output a x-gitbook-route-type header to distinguish static/dynamic (#2938) 2025-03-07 10:29:50 +01:00
Nolann B. bb3ca9c165 Implement OpenAPI models blocks (#2908) 2025-03-07 09:44:14 +01:00
Samy Pessé 8ee9757132 v2: cleanup deployment to Cloudflare (#2937) 2025-03-07 09:15:43 +01:00
Samy Pessé 946a463979 v2: Fix deployment to Cloudflare and improve CI (#2935) 2025-03-07 00:01:07 +01:00
Samy Pessé 7aad9f7ff8 v2: render code block with syntax highlighting on the server (#2932) 2025-03-06 15:07:06 +01:00
Greg Bergé 3fe8f7c219 Fix circular refs OpenAPI (#2934) 2025-03-06 10:32:49 +00:00
Greg Bergé 0278a14e8e Upgrade Scalar client & fix opening endpoint (#2933) 2025-03-06 11:28:51 +01:00
Samy Pessé e5366d3a49 v2: fix error handling in middleware and data fetcher (#2925) 2025-03-06 10:53:17 +01:00
Samy Pessé 38e84ffe1a Persist visitor auth token in cookie for as long as the token is valid (#2931) 2025-03-06 09:45:25 +01:00
Greg Bergé 052e07a936 Support references pointing to invalid files (#2930) 2025-03-05 21:37:46 +01:00
Samy Pessé 7e67ebc11d Fix condition for public content cache (#2929) 2025-03-05 21:22:22 +01:00
Samy Pessé c9dea94717 V2: Add back redirect for trailing slash (#2928) 2025-03-05 21:06:33 +01:00
Samy Pessé 1344754ca9 v2: enable skipTrailingSlashRedirect in the middleware 2025-03-05 19:27:48 +01:00
Samy Pessé 0f4759fb89 Fix condition for VERCEL_URL 2025-03-05 16:30:59 +01:00
Samy Pessé 6d77b647a4 Skip requests to assets/main/vercel hosts in middleware (#2927) 2025-03-05 16:22:20 +01:00
Zeno Kapitein 5907bd9af4 Adjust hint spacing (#2873) 2025-03-05 15:59:58 +01:00
Samy Pessé b66d04c9c5 v2: fix resolution of revalidation requests (#2926) 2025-03-05 14:48:07 +01:00
Nolann B. 3173d8ec2d Remove top level circular refs in alternatives (#2924) 2025-03-05 14:08:34 +01:00
Samy Pessé 31e381035e Dynamic routing for v2: customization preview and visitor auth (#2922) 2025-03-05 11:25:44 +01:00
Greg Bergé 259074b81f Fix OpenAPI spec recursion (#2920) 2025-03-05 09:25:23 +01:00
Samy Pessé 9a2f5b9295 Fix host used for image resizing in v2 (#2923) 2025-03-04 23:42:15 +01:00
Greg Bergé 58cd70b0c1 Put back logs (#2919) 2025-03-04 20:33:29 +00:00
Samy Pessé 821899a767 Fix image resizing in v2 when url is being passed as x-gitbook-url (#2921) 2025-03-04 18:57:49 +01:00
Samy Pessé bfcc119ff3 Remove support for x-gitbook-host in v2 (#2918) 2025-03-04 18:36:43 +01:00
Samy Pessé 76c797498e Implement route to invalidate data cache (#2916) 2025-03-04 13:52:02 +01:00
Samy Pessé 13514bf6fa Version Packages (#2907)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-03-04 13:42:32 +01:00
Samy Pessé 05ffd0e321 Proper data cache tagging for computed content (#2915) 2025-03-04 12:26:09 +01:00
Samy Pessé 701eaad92a Fix use of server actions with proxied domains by using middleware (#2913) 2025-03-04 10:00:08 +01:00
Greg Bergé c66ef5dd10 Fix OpenAPI tabs selection (#2914) 2025-03-03 21:10:24 +00:00
Greg Bergé f774f9b3a0 Fix all tabs behaviour in OpenAPI blocks (#2912) 2025-03-03 17:11:54 +00:00
Samy Pessé 29dc7ccb1a Fix next.js configuration for serverActions 2025-03-03 17:05:46 +01:00
Samy Pessé 80237c34f9 Allow all origins (including sub-domains) for server actions 2025-03-03 16:54:16 +01:00
Samy Pessé 979233c5c0 Allow all origins for serverActions in v2 2025-03-03 16:21:05 +01:00
Samy Pessé 2f03e6acee Define GITBOOK_URL as serverActions.allowedOrigins (#2911) 2025-03-03 15:24:31 +01:00
Greg Bergé c492f09a19 Fix outline not visible on OpenAPI blocks (#2910) 2025-03-03 14:56:19 +01:00
Greg Bergé 2c3af5e73c Improve scrolling with lot of highlighted blocks (#2909) 2025-03-03 13:47:30 +00:00
Samy Pessé 6597f8508d V2: search and ask AI (#2889) 2025-03-03 11:53:32 +01:00
Nolann B. 8beb5d6bcf Add input elements to ContentKit (#2882) 2025-02-28 17:50:20 +00:00
Greg Bergé 53f5dbea26 Fix typing of shouldIgnoreEntity (#2906) 2025-02-28 17:38:58 +00:00
Samy Pessé 725952a106 Version Packages (#2881)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-28 17:22:32 +00:00
Greg Bergé 3319375e9a Support OpenAPI operation block (#2902) 2025-02-28 18:12:08 +01:00
spastorelli c5a4619020 Fix multi-id/preview mode not using context id for api cache calls (#2905) 2025-02-28 18:04:16 +01:00
Greg Bergé 989fc69abe Format package.json after running changeset (#2904) 2025-02-28 15:56:44 +00:00
Greg Bergé 0924259217 Expose OpenAPI helper shouldIgnoreEntity (#2903) 2025-02-28 16:22:20 +01:00
Taran Vohra 05affac34f Add support for proxy sites using x-gitbook-url in v2 (#2901) 2025-02-28 20:03:05 +05:30
Samy Pessé 453a459566 Fix content ref resolution for pages of other spaces (#2900) 2025-02-28 13:00:54 +01:00
Nolann B. 722f02ea09 Fix recursion in OpenAPISchemaAlternative (#2892) 2025-02-28 10:07:56 +00:00
Samy Pessé 5bcea2fe3b Fix signature verification with image resizing on v1 (#2899) 2025-02-28 10:36:10 +01:00
Samy Pessé 73afd1f5d0 Improve error message for image resizing (#2898) 2025-02-28 10:23:17 +01:00
Greg Bergé 9b8a0d3e54 Fix CI tests (#2897) 2025-02-28 10:14:09 +01:00
Samy Pessé 75bd98d66c V2: robots.txt, sitemap.xml, image resizing, etc (#2895) 2025-02-28 09:52:56 +01:00
Taran Vohra 9b914d10bd Fix getProxyModeBasePath (#2896) 2025-02-28 12:27:25 +05:30
Brett Jephson 3e11678d8d fix: section groups went missing (#2891) 2025-02-28 00:00:39 +01:00
Samy Pessé 6e03638130 Remove loading.tsx for static rendering in v2 (#2894) 2025-02-27 18:23:06 +01:00
Greg Bergé 23f884efb7 Fix the fonts display on the site (#2893) 2025-02-27 17:27:17 +01:00
Taran Vohra 2ae76f999b Change how a site in proxy mode is resolved (#2890) 2025-02-27 21:43:29 +05:30
Samy Pessé 685325cdc7 Deploy v2 to staging from main using a composite action (#2888) 2025-02-27 11:12:02 +01:00
Samy Pessé ab132eadb7 Cache OpenAPI using next "use cache" for v2 (#2887) 2025-02-27 09:39:08 +01:00
Samy Pessé 14504e43b5 V2: embeds and CSP (#2885) 2025-02-27 08:44:32 +01:00
Taran Vohra 4ed79574e8 change proxy mode site lookup url (#2886) 2025-02-27 12:38:55 +05:30
Samy Pessé 31bcd1a386 Improve detection of code path not supported in v2, add visual tests (#2884) 2025-02-26 20:18:38 +01:00
Samy Pessé 270e5ef7ad Improve linking to other sections/variants in development (#2883) 2025-02-26 19:14:27 +01:00
Samy Pessé 1f4733355e Remove eslint/prettier and switch to biome (#2880) 2025-02-26 17:59:34 +01:00
Zeno Kapitein 027a859ef4 Add link styles (#2861) 2025-02-26 13:03:14 +00:00
Samy Pessé 59f50eaee7 Fix production deployments to Vercel (#2879) 2025-02-26 13:47:24 +01:00
Samy Pessé 80d2733c25 Version Packages (#2859)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-26 13:41:20 +01:00
Samy Pessé feb6735a4d Abstract data fetching between v1 and v2 (#2865) 2025-02-26 13:20:16 +01:00
Nolann B. f1d1d2fd81 Return empty string if no server provided (#2878) 2025-02-26 09:13:27 +01:00
Greg Bergé a749c67803 Extract and remove unused code around OpenAPI servers (#2867) 2025-02-25 17:39:27 +01:00
Nolann B. c808bb1483 Fallback to untrusted validation in case JSON OpenAPI spec is invalid (#2877) 2025-02-25 17:27:31 +01:00
Greg Bergé e24206ebf0 Remove dependency to swagger2openapi and yaml (#2874) 2025-02-25 15:42:11 +01:00
Greg Bergé 3410785a3a Remove .tsbuildinfo (#2875) 2025-02-25 15:24:12 +01:00
Nolann B. b4a12d606e Fix circularRef in schema + examples OpenAPI (#2872) 2025-02-24 21:26:26 +01:00
Greg Bergé a0545545d7 Faster OpenAPI spec validation (#2871) 2025-02-24 21:21:27 +01:00
Zeno Kapitein 1f11650ca1 Bump hint icon up 1px (#2869) 2025-02-24 16:21:19 +01:00
Greg Bergé da55facf2c Support GitBook blocks in OpenAPI operation description (#2868) 2025-02-24 13:44:48 +01:00
Nolann B. dc2dbc5710 Update OpenAPI code examples to support multiple content-type (#2843) 2025-02-24 13:07:35 +01:00
Nolann B. bdd6303bcc Rearrange item types in OpenAPI blocks (#2862) 2025-02-24 11:33:47 +01:00
Zeno Kapitein 66d0fc0683 Update hint block (#2840)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
2025-02-21 15:32:35 +01:00
Nolann B. 05e1d8cd96 Hide x-gitbook-* symbols in OpenAPI blocks (#2863) 2025-02-21 12:38:55 +01:00
Greg Bergé 9f0de74caa Add support for new OpenAPI ref (#2860) 2025-02-20 14:31:04 +01:00
spastorelli a820739bd2 Remove ununsed search api lib methods (#2855) 2025-02-20 09:46:12 +01:00
Samy Pessé 304042017c Version Packages (#2847)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-20 08:36:09 +01:00
Greg Bergé 82cd9f2979 Add support for anchor link in OpenAPI blocks (#2858) 2025-02-19 23:38:20 +01:00
Greg Bergé a3f1fea27b Display OpenAPI header description (#2857) 2025-02-19 23:34:52 +01:00
Greg Bergé bb5c6a42e7 Support multiple examples and multiple responses example (#2856) 2025-02-19 20:39:15 +01:00
Valentino Hudhra 445baaaa61 Add a new packages @gitbook/colors (#2854)
Co-authored-by: Zeno Kapitein <zenomilan@me.com>
2025-02-19 17:17:39 +01:00
Nolann B. 7419ee7dba Show additional fields in OpenAPI block (#2851) 2025-02-19 17:01:15 +01:00
Nolann B. aa6be381a4 Make OpenAPI tabs list scrollable if overflowing (#2848) 2025-02-19 11:10:11 +01:00
Greg Bergé 61575838f3 Optimize markdown parsing (#2850) 2025-02-19 10:29:33 +01:00
Samy Pessé 359bb979f8 Open external link in a new tab when embedded in an iframe (#2846) 2025-02-18 12:41:45 +00:00
Greg Bergé b29a885bae Fix NPM_TOKEN used to publish packages (#2844) 2025-02-18 10:25:55 +01:00
Samy Pessé 919da7f2c9 Version Packages (#2839)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-18 00:44:59 +01:00
Greg Bergé d222c116e0 Fix avoid showing child attributes if empty (#2842) 2025-02-17 17:12:26 +01:00
Greg Bergé df840dac18 Avoid parsing example description (#2841) 2025-02-17 17:12:16 +01:00
Nolann B. f8d4c7697c Fix schema validation error (#2820) 2025-02-17 15:11:58 +01:00
Nolann B. dddb4ecbb8 Fix OpenAPI long tab group description (#2838) 2025-02-17 12:51:13 +01:00
Greg Bergé 470d10cb47 Mark GitBook v2 as private (#2837) 2025-02-17 09:41:20 +01:00
Samy Pessé dae11e9607 Version Packages (#2644)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-02-17 09:12:54 +01:00
Greg Bergé 3d1eb53708 Run visual testing on customers docs (#2833)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
Co-authored-by: Valentino Hudhra <2587839+valentin0h@users.noreply.github.com>
2025-02-14 17:00:48 +01:00
Zeno Kapitein a76c9a56a7 Flip card logic (#2835) 2025-02-14 15:34:03 +01:00
Greg Bergé eaad0d4e09 Fix visual testing logo flakiness (#2834) 2025-02-14 12:16:45 +01:00
Greg Bergé 46edde9da6 Improve OpenAPI abstraction to be more flexible on usage (#2832) 2025-02-14 10:41:09 +01:00
Nolann B. dda0cc635e Flatten OpenAPI security object (#2818) 2025-02-13 16:44:06 +01:00
Greg Bergé 727bde2d16 Refactor and optimize OpenAPI parsing (#2830) 2025-02-13 16:30:34 +01:00
Zeno Kapitein 9f30af1b33 Fix card layout for cards without cover (#2831) 2025-02-13 15:13:03 +01:00
Zeno Kapitein ff05e20537 Improvements to inline images in headings (#2829) 2025-02-13 13:44:16 +01:00
Scott Cazan 53de5b13c1 Fix URL resolution in Site Sections for Ask (#2827) 2025-02-13 09:22:11 +01:00
Zeno Kapitein a025118f69 Change card layout depending on cover aspect ratio (#2828) 2025-02-12 17:21:52 +01:00
Zeno Kapitein 71688a817b Implement new themes (#2822)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
2025-02-12 15:37:41 +01:00
Zeno Kapitein 00c476ea7f Fix typo in sticky page outline (#2826) 2025-02-12 09:13:45 +01:00
Samy Pessé 5576906914 Fix table of content displaying arrow next to page with only hidden pages (#2825) 2025-02-10 16:24:27 +01:00
Samy Pessé d5aaccd2c4 Remove use of deprecated API createSitesPageFeedback (#2824) 2025-02-10 13:20:33 +01:00
Samy Pessé 7059c2ba25 Fetch computed document (#2823) 2025-02-07 23:09:16 +01:00
Brett Jephson aaab157d49 Section groups visual bug fix (#2821) 2025-02-07 15:53:51 +00:00
Greg Bergé 9943276c0c Revert PR with bugs (#2819) 2025-02-07 15:08:58 +01:00
Nolann B. c31cf5243a Sync tabs across all OpenAPI blocks (#2817) 2025-02-07 13:15:06 +01:00
Nolann B. 0c03676efb Improve OpenAPI Securities sample and headers (#2816) 2025-02-07 12:35:46 +01:00
Nolann B. 883d10acf8 Support for OpenAPI references (#2813) 2025-02-07 11:46:23 +01:00
Nolann B. 3e5e458118 Handle isArray schema type (#2815) 2025-02-07 11:23:36 +01:00
Brett Jephson 0510b6f29e Add section description (#2814) 2025-02-06 16:53:48 +00:00
Zeno Kapitein 92b7668bf3 Fix header offset (#2812) 2025-02-06 15:12:07 +01:00
Scott Cazan 3973b1cbf3 Handle unresolved references in OpenAPI response' (#2811)
Co-authored-by: Steven H <steven@gitbook.io>
2025-02-06 11:25:42 +01:00
Nolann B. 160fca1ea1 Update OpenAPI design (#2787) 2025-02-06 10:47:23 +01:00
Zeno Kapitein e90c96f7e9 Page outline positioning (#2805)
Co-authored-by: Claire Chabas <claire.chabas@gmail.com>
2025-02-05 17:08:30 +01:00
Scott Cazan d935fb1b2e Only push scrolling down when Footer is present (#2807) 2025-02-05 12:26:31 +01:00
Scott Cazan a6529584a5 Handle Errors from Unresolved Refs (#2810) 2025-02-05 10:52:35 +00:00
Zeno Kapitein 18953b2d6b Make tint color subtler when equal to primary color (#2808)
Co-authored-by: Valentino Hudhra <2587839+valentin0h@users.noreply.github.com>
2025-02-05 11:40:19 +01:00
Zeno Kapitein 21cbd9e3b0 Change link color to primary subtle (#2809) 2025-02-05 09:02:53 +01:00
Brett Jephson 38061bdf65 RND-5646: section groups navigation menu (#2789) 2025-02-04 17:07:57 +00:00
Nolann B. d9029c7e1e Include apiKey example in CodeSample security headers (#2804) 2025-02-04 17:19:39 +01:00
Steven H fe8acc986e Fix an issue where a missing OpenAPI example would crash the page. (#2806) 2025-02-04 11:48:38 +00:00
Nolann B. e721f17f7e Implement Scalar's getExampleFromSchema (#2802) 2025-02-04 11:59:47 +01:00
Nolann B. 2f73db785e Support non primitive examples in OpenAPI block (#2775) 2025-02-03 17:07:29 +01:00
Zeno Kapitein 9e18ae6587 Overhaul colour system & classes (#2783) 2025-02-03 12:23:19 +01:00
Samy Pessé 9eca010f94 Improve display of recommended questions using streaming (#2800) 2025-01-31 23:13:40 +01:00
Greg Bergé 6e54a06d9c Support response examples in API blocks (#2799) 2025-01-31 18:47:29 +01:00
Greg Bergé 1f8e416e41 Highlight code client-side (#2797) 2025-01-31 13:47:37 +01:00
Samy Pessé cfccc44406 Setup package and deployment for v2 (#2791) 2025-01-31 12:28:41 +01:00
Claire Chabas 45b30c9c27 Fix icons generate script (#2798) 2025-01-31 11:05:38 +01:00
Samy Pessé 67f78368fb Revert "Highlight code client-side" (#2796) 2025-01-30 20:09:57 +01:00
Greg Bergé d9c8d57e8e Avoid dereferencing before caching (#2793) 2025-01-30 17:15:19 +01:00
Greg Bergé 0d615e3888 Highlight code client-side (#2786) 2025-01-30 16:08:39 +01:00
Greg Bergé 68287d3df4 Cache API spec for 24 hours, revalidated every 2 hours (#2792) 2025-01-30 15:16:45 +01:00
Greg Bergé dff08ae3e3 Load Scalar only when the button is pressed (#2790) 2025-01-30 15:01:59 +01:00
Zeno Kapitein 8cfa67c1dd Fix default outline list styling (#2788) 2025-01-30 13:56:43 +01:00
Greg Bergé b41d425993 Improve OpenAPI performances (#2784) 2025-01-30 11:13:01 +01:00
Greg Bergé 12c7862250 Use Scalar OpenAPI parser (#2780) 2025-01-30 08:44:08 +01:00
Greg Bergé 6f54826296 Replace highlight colors (#2781) 2025-01-29 15:00:01 +01:00
Steven H ccf2cffc4b Hotfix docs.radiantdrift.com crashing in production. (#2782) 2025-01-29 12:42:01 +00:00
Zeno Kapitein f7b801b4c8 Support user comments after rating (#2771)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2025-01-28 09:39:32 +01:00
Samy Pessé 95f2aa45eb Integration with new site insights (#2777) 2025-01-28 09:18:50 +01:00
Samy Pessé 9524ff5f5a Migrate to bun text-based lockfile (#2770) 2025-01-28 08:47:40 +01:00
Steven H 1823101b03 Fix internal properties appearing in OpenAPI docs. (#2774) 2025-01-23 21:35:06 +00:00
Samy Pessé 1a8cfd2a8b Hide toolbar when previewing (#2773) 2025-01-23 21:58:02 +01:00
Greg Bergé 5b4e710770 Support llms.txt (#2768) 2025-01-23 16:37:45 +01:00
Zeno Kapitein 1762f85ef9 Reduce gap between subsequent header buttons (#2765) 2025-01-23 14:10:47 +01:00
Samy Pessé d370a3f0e3 Align the revisions/changes path for multi-id with the normal one (#2769) 2025-01-23 10:00:11 +01:00
Greg Bergé d3e573c2e9 Generate sitemap for all sections and spaces (#2767) 2025-01-22 16:57:57 +01:00
Zeno Kapitein 94876e3ad1 Fix regression issue with page icons for multi-line titles (#2764) 2025-01-21 17:03:33 +01:00
Zeno Kapitein ad190602c7 Tweak card background, better margins for card headings (#2763) 2025-01-21 17:03:22 +01:00
Scott Cazan 162b4b78b6 Add HTTP examples to API blocks (#2759) 2025-01-21 15:34:42 +01:00
Zeno Kapitein e5dc05e994 Restyle footer, allow >4 link groups (#2761) 2025-01-21 14:50:33 +01:00
Samy Pessé b46cff70c0 Fix insights prop passed to Link (#2760) 2025-01-21 07:52:00 +01:00
Greg Bergé b6c3870eda Add support for keyboard marks (#2758) 2025-01-20 12:06:38 +01:00
Taran Vohra 1c1f504601 Fix Image zoom e2e test (#2757) 2025-01-20 16:13:23 +05:30
Taran Vohra 1b8a45678c Fix image blocks zoomable behaviour (#2756) 2025-01-20 13:22:12 +05:30
Viktor Renkema 38de9eb9d7 Restore borders on embed blocks with Captions (#2755) 2025-01-17 12:50:23 +01:00
Greg Bergé eac1314a7d Lazy load iframely script (#2753) 2025-01-17 08:28:38 +01:00
Greg Bergé 29d59793dc Disable C/C++ highlight temporarily (#2754) 2025-01-17 08:28:10 +01:00
Greg Bergé 128ad20280 Ignore cache invalidation error from local backend (#2752) 2025-01-15 14:13:10 +01:00
Viktor Renkema 994ebff8c1 Remove borders on Caption wrapper (#2742) 2025-01-15 12:05:13 +01:00
Greg Bergé 142938401c Fix error when accessing some not found pages (#2751) 2025-01-15 12:04:27 +01:00
Greg Bergé 65cc4afb23 Fix error when accessing a change request not found (#2723) 2025-01-14 19:52:26 +01:00
Greg Bergé e000f23c44 Fix visual testing flakiness (#2750) 2025-01-14 18:03:29 +01:00
Claire Chabas 1de9d1aa33 Antialias text but not code/pre elements (#2747) 2025-01-14 15:48:05 +01:00
Zeno Kapitein 0e601e277b Header button styling (#2748) 2025-01-14 15:20:26 +01:00
Greg Bergé e582a47f37 Remove screenshot from VA test (#2749) 2025-01-14 15:05:04 +01:00
Greg Bergé 1b251a78b0 Fix visitor authentication end-to-end tests (#2746) 2025-01-14 14:42:58 +01:00
Zeno Kapitein 24f5249ae9 Fix vertical section overflow (#2744) 2025-01-14 12:49:20 +01:00
Greg Bergé 17c1631013 Visual testing stabilization (#2741) 2025-01-14 12:39:12 +01:00
Greg Bergé cb100d5e00 Allow only valid values for theme query string (#2745) 2025-01-14 12:33:59 +01:00
Greg Bergé 1fcc807513 Fix customization not found (#2734) 2025-01-14 12:09:43 +01:00
Zeno Kapitein 5664e5a30f Fix variant dropdown styling in header (#2730) 2025-01-14 12:09:04 +01:00
Taran Vohra 26e64019d8 Remove KV cache backend and only use DO cache (#2743) 2025-01-14 16:29:48 +05:30
Zeno Kapitein 56331d2e74 Fix breadcrumbs emoji display + add contrast styles (#2735) 2025-01-14 11:46:26 +01:00
Greg Bergé 55b095e503 Wait for icons to be loaded before screenshot (#2740) 2025-01-14 10:35:44 +01:00
Scott Cazan 6a073e1dd5 Enable anti-aliasing for published docs (#2736) 2025-01-14 10:13:40 +01:00
Viktor Renkema 960e25a3f6 Apply vertical alignment to Tables as configured in-app (#2627) 2025-01-14 09:45:15 +01:00
Greg Bergé 1de338c312 Remove useless animation on section tabs (#2739) 2025-01-14 08:57:08 +01:00
Steven H dbba50cea4 Fix an issue where search and Ask AI triggers unnecessary renders when in a Visitor Authenticated site. (#2738) 2025-01-13 21:31:40 +00:00
Zeno Kapitein 8f046a9cd6 Start using tint in more places: TOC and PageAside (#2733) 2025-01-13 15:00:19 +01:00
Greg Bergé 2906e6038a Downgrade to Next.js v14 (#2732) 2025-01-13 14:50:31 +01:00
Greg Bergé 87b8ea8c05 Revert reading a context from headers and passing it (#2727) 2025-01-13 12:44:00 +01:00
Greg Bergé 47971dce31 Fix OG image generation (#2729) 2025-01-13 12:20:24 +01:00
Greg Bergé 528a05398c Fix server actions stability (#2728)
Co-authored-by: Steven Hall <steven@gitbook.io>
2025-01-13 10:04:14 +00:00
Taran Vohra f584148ab9 temporarily add back cloudflare KV cache backend (#2726) 2025-01-12 12:57:38 +05:30
Zeno Kapitein 0de22f7a96 Fix padding of ads box (#2724) 2025-01-10 21:49:54 +01:00
Greg Bergé 09c7c30779 Try to fix error on og image generation (#2722) 2025-01-10 21:38:25 +01:00
Greg Bergé fde32e26bf Force route handler to be dynamic to avoid errors (#2721) 2025-01-10 16:26:25 +01:00
Greg Bergé a6f65916f1 Separate cache for HTTP methods (#2720) 2025-01-10 16:09:35 +01:00
Claire Chabas 6059efe094 Fix no results showing while there are results (#2719) 2025-01-10 16:08:45 +01:00
Zeno Kapitein 16194c50ba Vertical orientation for sections list on sites without header (#2714) 2025-01-10 14:40:10 +01:00
Steven H af3c6a971c Reintroduce a safety check around search whilst we continue investigating caching. (#2718)
Co-authored-by: Greg Bergé <berge.greg@gmail.com>
2025-01-10 13:32:44 +00:00
Greg Bergé ecfdb976a3 Cleanup headers usage (#2717) 2025-01-10 14:15:39 +01:00
Steven H 08acea651a Log an exception if an empty cache object is returned (#2716)
Co-authored-by: Greg Bergé <berge.greg@gmail.com>
2025-01-10 09:25:40 +00:00
Greg Bergé 6b503608cd Fix view transition error on Safari (#2715) 2025-01-10 07:27:49 +01:00
Greg Bergé d8763997a5 Fix UI search with no ask (#2713) 2025-01-09 17:22:06 +01:00
Greg Bergé 32aa1f99c1 Handle security issue with cookies on Safari (#2711) 2025-01-09 17:04:26 +01:00
Valentino Hudhra 718a8a54b1 Position the variant picker in the ToC (#2632)
Co-authored-by: Zeno Kapitein <admin@zeno.zone>
Co-authored-by: Zeno Kapitein <zenomilan@me.com>
2025-01-09 16:47:20 +01:00
Zeno Kapitein 741dd490d4 Bump heading-3 font size to differentiate it from paragraphs (#2706) 2025-01-09 16:43:04 +01:00
Greg Bergé 02d876e6d8 Fix search UI behaviour (#2712) 2025-01-09 16:27:04 +01:00
Greg Bergé 56c52e0bb0 Handle Firefox security error on localStorage (#2710) 2025-01-09 15:36:08 +01:00
Greg Bergé 6036becf93 Fix header menu scroll ref logic (#2708) 2025-01-09 14:22:34 +01:00
Greg Bergé 3a7210d514 Fix zoom image view transition on Safari (#2709) 2025-01-09 14:08:45 +01:00
Greg Bergé 6088fa582d Simplify search results logic (#2707) 2025-01-09 13:53:21 +01:00
Greg Bergé 6691492ef7 Fix viewing pdf from space (#2705) 2025-01-09 12:28:48 +01:00
Zeno Kapitein 7ee9158cd3 Restyle PageAside to use sidebar list styles (#2680)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
Co-authored-by: Valentino Hudhra <2587839+valentin0h@users.noreply.github.com>
2025-01-09 11:21:30 +01:00
Claire Chabas 5ae1b883ab Fix shrinking page icons (#2702) 2025-01-08 16:59:32 +01:00
Greg Bergé 88397bf419 Flush Sentry events manually server-side (#2698) 2025-01-08 14:57:15 +01:00
Valentino Hudhra 1138d5935b Add sidebar new background styles (#2645)
Co-authored-by: Zeno Kapitein <admin@zeno.zone>
2025-01-08 14:01:06 +01:00
Greg Bergé 8276ba080e Make cookies access safer (#2694) 2025-01-08 13:12:41 +01:00
Greg Bergé 37d13d80f5 Pass string URL to fetch to avoid errors (#2695) 2025-01-08 13:01:10 +01:00
Greg Bergé 1c97536ab1 Fix Sentry instrumentation (again) (#2697) 2025-01-08 12:28:08 +01:00
Greg Bergé ca8f028cc0 Fix error in header mobile menu (#2696) 2025-01-08 11:09:58 +00:00
Claire Chabas 300f7bfe4b Fix search loading state (#2684) 2025-01-08 11:52:12 +01:00
Greg Bergé 82dc9c40f7 Simplify useHash algo used (#2689) 2025-01-08 11:37:48 +01:00
Greg Bergé 44a20fe5ee Improve scroll listener (#2692) 2025-01-08 11:17:22 +01:00
Greg Bergé b950a64406 improve browser support (#2693) 2025-01-08 11:08:29 +01:00
Greg Bergé c5f374f66f Move instrumentation to src folder (#2691) 2025-01-08 10:55:56 +01:00
Greg Bergé ae99f87db0 Improve emoji setup (#2688) 2025-01-08 10:11:35 +01:00
Greg Bergé 5112e3e79b Fix Sentry instrumentation server-side (#2690) 2025-01-08 09:52:02 +01:00
Greg Bergé c1e27ccacc Fix pass Sentry release properly (#2687) 2025-01-08 09:12:34 +01:00
Greg Bergé b0bd871997 Even safer local storage... (#2686) 2025-01-07 17:57:02 +01:00
Greg Bergé c30bc24fd6 Fix empty sitemap (#2685) 2025-01-07 17:09:51 +01:00
Greg Bergé 648f0e9e84 Various fixes (#2683) 2025-01-07 16:54:10 +01:00
Greg Bergé d2bc5672e0 Set Sentry release (#2682) 2025-01-07 16:36:44 +01:00
Greg Bergé 5c87ec7c2f Safer way to interact with localStorage (#2679) 2025-01-07 15:51:23 +01:00
Greg Bergé d66c184ed2 Ignore errors from event flushing (#2681) 2025-01-07 15:38:18 +01:00
Greg Bergé 12f25d8bfc Fix error from visitor id not set (#2678) 2025-01-07 15:18:05 +01:00
Greg Bergé cbe61397a3 Fix dynamic tabs infinite loop (#2677) 2025-01-07 14:54:28 +01:00
Greg Bergé deb8c54da3 Upgrade Next.js to v15 (#2671) 2025-01-07 10:42:02 +01:00
Greg Bergé 5dab70fab4 Fix "Parser" language syntax highlighting (#2676) 2025-01-07 10:23:25 +01:00
Greg Bergé 665b6bed66 Ignore invalid API calls to getSiteRedirectFromSource API (#2675) 2025-01-07 10:06:31 +01:00
Greg Bergé f4a90defc3 Remove Recoil (#2674) 2025-01-06 16:06:59 +01:00
Greg Bergé 46f63cbd55 Fix code format overriding (#2673)
Co-authored-by: eztaK-red <eztak.red@gmail.com>
2025-01-06 15:15:39 +01:00
Greg Bergé c77142a16f Log component stack in Sentry (#2672) 2025-01-06 13:14:22 +01:00
Steven H eb7c22f52a Revert Scalar to a previous version to mitigate an app crash happening when switching between API pages. (#2670) 2025-01-06 11:57:51 +00:00
Steven H e86e51f06f Fix an issue where the redirects of potentially malicious images were not going through. (#2666) 2024-12-30 14:41:54 +00:00
Steven H db74ea3001 Image optimization endpoint redirects to underlying image URL if the signature is not the latest. (#2665) 2024-12-30 13:08:49 +00:00
Steven H 99579ac29c Fix a vulnerability issue for images using an older version of the image signing parameter. (#2664) 2024-12-30 11:29:30 +00:00
Samy Pessé 2f6540e008 Don't cache VA and adaptive content responses (#2663) 2024-12-27 17:56:42 +01:00
Samy Pessé 72c3b80529 Pass visitor auth token to site insights events (#2662) 2024-12-26 19:06:29 +01:00
Viktor Renkema 8126a83c50 Reintro vertical table lines + hover state (#2653) 2024-12-25 08:41:54 +01:00
Samy Pessé 210c432b37 Fix PDF export crashing (#2661) 2024-12-23 14:52:50 +01:00
Amrit Kahlon f92e90603f Prevent multiple versions of codemirror from loading (#2660)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-12-21 23:46:16 +01:00
Samy Pessé 14172791e9 Track click on links for site insights (#2659) 2024-12-21 18:18:30 +01:00
Samy Pessé e4e2f524d4 Track site insight event when opening scalar client (#2658) 2024-12-21 15:57:10 +01:00
Amrit Kahlon fc7b16f6a7 Update scalar dependency (#2652) 2024-12-20 23:16:11 +01:00
Samy Pessé 6ba3ae74d5 Workaround until referrer is accepted by API as an empty string (#2656) 2024-12-20 19:23:52 +01:00
Samy Pessé c71d1598d8 Insights site events support (#2655) 2024-12-20 19:06:50 +01:00
Greg Bergé 5950657b0e Fix emojis display (#2648) 2024-12-20 11:30:56 +01:00
Samy Pessé 0e1a48cd06 Upgrade bun and setup-bun, switch to text lockfile (#2651)
Co-authored-by: Greg Bergé <berge.greg@gmail.com>
2024-12-20 11:19:54 +01:00
spastorelli 98245e5f20 Adapt code to pull token from customer backend generated custom cookies (#2650)
Co-authored-by: Steven Hall <steven@gitbook.io>
2024-12-19 18:29:32 +01:00
Zeno Kapitein 0b6ddca981 Fix variant selector for non-default themes (#2649) 2024-12-19 12:28:13 +01:00
spastorelli ea1468c892 Send redirectOnError param to getPublishedContent when token is pulled from cookie (#2626) 2024-12-19 11:16:06 +01:00
Greg Bergé e8e64bf510 Fix bullet list display on full size blocks (#2646) 2024-12-18 13:55:18 +01:00
Greg Bergé aaf8daf0d7 Improve search UI (#2643) 2024-12-18 13:42:47 +01:00
Zeno Kapitein 8af1abc4e1 Improve contrast of search box placeholder (#2639) 2024-12-18 12:14:06 +01:00
Zeno Kapitein 48ab59feb3 Improve contrast of list decoration (#2638) 2024-12-18 11:49:01 +01:00
Samy Pessé f64d5073d4 Version Packages (#2557)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-18 10:25:08 +01:00
Samy Pessé 53b9f10ac8 Prepare @gitbook/proxy to support serving under sub-directory (#2641) 2024-12-18 10:05:31 +01:00
Samy Pessé 75606e4df7 Fix missing env GITBOOK_ASSETS_PREFIX passed to build (#2642) 2024-12-17 21:46:04 +01:00
Claire Chabas 0643b7f351 Improve ask/search Enter key press UX (#2624)
Co-authored-by: Zeno Kapitein <admin@zeno.zone>
2024-12-17 18:08:29 +01:00
Claire Chabas 5b3b4e0614 Fix closing search modal on Escape key press (#2637) 2024-12-17 15:33:36 +01:00
Samy Pessé 8d039d1348 Pass down ancestors instead of computing them (#2635) 2024-12-16 21:11:46 +01:00
Zeno Kapitein 87eea73081 Fix margin and image resolution of header logo (#2633) 2024-12-16 14:34:00 +01:00
Zeno Kapitein 67a6fb4c87 Fix localised search string from wrapping search box (#2630) 2024-12-13 16:48:06 +01:00
Zeno Kapitein 23584c9862 Update header styling (#2613)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
Co-authored-by: Valentino Hudhra <2587839+valentin0h@users.noreply.github.com>
2024-12-13 15:51:23 +01:00
Zeno Kapitein 2f767125c4 Add breadcrumbs to page header (#2628) 2024-12-13 15:20:07 +01:00
Greg Bergé c73e07d42d Increase token max length to fix code not highlighted (#2629) 2024-12-13 13:16:55 +01:00
Viktor Renkema 6b5d7e6057 Improve styles of Tables (#2623) 2024-12-13 08:15:52 +01:00
Greg Bergé 076dc48e89 Fix expandable block anchor resolution (#2625) 2024-12-12 23:25:29 +01:00
Greg Bergé bb208ab36a Update JoyPixels (#2619) 2024-12-12 09:05:12 +01:00
Viktor Renkema 60e35001b6 Refactor Table to use flex layouts (#2622) 2024-12-11 21:34:37 +01:00
Greg Bergé 29a0d7ea02 Fix sublinks display on mobile (#2620) 2024-12-11 18:57:55 +01:00
Greg Bergé 1f2b7f7acf Prevent resizing AVIF (not supported by Cloudflare) (#2621) 2024-12-11 15:17:25 +01:00
spastorelli 39e5cb63ef Fix context Id not returned by lookupSpaceByAPI (#2618) 2024-12-11 10:54:17 +01:00
spastorelli 5b5928fb8d Fix VA e2e tests when ran locally (#2617) 2024-12-11 08:34:05 +01:00
Greg Bergé 08068743a5 Remove Next.js cache on CI (#2616) 2024-12-10 18:53:47 +01:00
Greg Bergé 35eae1adcf Fix canonical in a safe way (#2589) 2024-12-10 17:47:57 +01:00
Greg Bergé e85d357abd Fix React DOM warning (#2615) 2024-12-10 17:39:22 +01:00
spastorelli 31396d8109 Adapt GBO cache logic to support users sessions info (#2606) 2024-12-10 14:11:59 +01:00
Zeno Kapitein 664debc0bc Add tint color (#2605)
Co-authored-by: Valentino Hudhra <v.hudhra@gmail.com>
Co-authored-by: Valentino Hudhra <2587839+valentin0h@users.noreply.github.com>
2024-12-09 17:19:44 +01:00
Viktor Renkema 56c31c76b3 Center-align inline images (#2609) 2024-12-09 13:21:43 +01:00
Viktor Renkema 2d1a71f3d1 Allow cells in tables to use more available space (#2611) 2024-12-09 13:11:05 +01:00
Valentino Hudhra c67cd73058 Add visual tests for tint (#2601) 2024-12-09 12:29:03 +01:00
Greg Bergé 2572cb4352 Pin React versions (#2610) 2024-12-09 11:14:02 +01:00
Steven H c9f6c7ccac Fix an issue where Ask AI answers with too many sources could crash the Worker. (#2608) 2024-12-07 15:23:10 +00:00
Steven Hall b6520b0dbc hotfix: Fix an issue where Ask AI was crashing on some requests. 2024-12-06 22:26:41 +00:00
Steven H 9fe8142117 Fix an issue where Ask AI was erroring due to an object being passed as a param. (#2607) 2024-12-06 21:55:59 +00:00
Steven H 57cdd25b5f Ask AI now goes through the site API instead of spaces. (#2598) 2024-12-06 20:06:49 +00:00
Samy Pessé 1005ee5d52 Prevent resizing the url of an image already resized (#2600) 2024-12-05 16:34:31 +01:00
Valentino Hudhra d9bb9f9a07 Fix cookie banner button being non responsive (#2599) 2024-12-05 14:04:03 +01:00
Greg Bergé 75a6fabe61 Support dropdown without link (#2596) 2024-12-04 12:05:17 +01:00
Greg Bergé 75e29b69cc Allow to work locally (#2597) 2024-12-03 14:49:13 +01:00
Samy Pessé ffd3937538 Fix security issue with images resizing (#2595) 2024-12-03 08:51:46 +01:00
Valentino Hudhra 575587e4c5 Improve footer link styling (#2591) 2024-12-01 07:54:45 +01:00
Brett Jephson 2ce59d7c92 Fix whitespace added with image (#2594) 2024-11-29 17:10:29 +00:00
Brett Jephson 3b3d6e2a73 Add an icon to site sections (#2593) 2024-11-29 16:09:06 +00:00
Zeno Kapitein f2a467fdbf Fix hint block decoration color (#2590) 2024-11-29 16:40:10 +01:00
vibhanshub 867481c66d Support Integers in Response sample (#2592) 2024-11-28 14:19:37 +00:00
spastorelli fc8065b7a8 Revert "Fix canonical URL ending with "/" (#2586)" (#2588) 2024-11-27 13:05:34 +01:00
Greg Bergé 28f1ed9205 Fix canonical URL ending with "/" (#2586) 2024-11-26 21:57:15 +01:00
Viktor Renkema 568266bc9a Add transitions to Sections bg and line (#2491) 2024-11-26 19:59:07 +01:00
Samy Pessé 7739f341b8 Revert "Serve the correct status code for not found and redirects 👌" (#2587) 2024-11-26 18:36:00 +01:00
Greg Bergé 2b501f191c Serve the correct status code for not found and redirects 👌 (#2582) 2024-11-26 18:05:47 +01:00
Zeno Kapitein aa2ed0fda1 Restyle hint block (#2579) 2024-11-26 12:41:47 +01:00
Greg Bergé 51cba074d7 Update shiki (#2583) 2024-11-26 11:50:08 +01:00
Taran Vohra 2c945c663c Get the best possible target space for content refs (#2580) 2024-11-26 10:53:37 +05:30
Viktor Renkema d9a18ecabb Improve contrast ratio for text color on image captions (#2584) 2024-11-25 14:01:09 +01:00
Greg Bergé eab7931afb Parallelize and remove useless Promise.all (#2581) 2024-11-22 15:54:56 +01:00
Taran Vohra 99b6c92377 Resolve site level redirects (#2577) 2024-11-22 12:04:15 +05:30
Zeno Kapitein 4d56f1163b Improve styling of search & ask AI box (#2576) 2024-11-20 16:59:15 +01:00
Brett Jephson 07cf835551 Add a scroll margin to the top when layout has sections (#2574) 2024-11-19 16:34:27 +00:00
Steven H 061c0c1a90 Fix a regression in variant drop-down caused by missing z-index. (#2575) 2024-11-19 17:23:44 +01:00
Anthony Lio 1ed18c05ef Adds missing css variables (#2558)
Co-authored-by: Steven H <steven@gitbook.io>
2024-11-19 16:08:07 +01:00
Steven H ca134c8a60 Fix an issue where the active site section indicator appeared above any dropdowns. (#2568) 2024-11-19 15:16:47 +01:00
Amrit Kahlon 7ba67fd852 chore: scalar bump (#2571)
Co-authored-by: Steven Hall <steven@gitbook.io>
2024-11-19 13:54:35 +01:00
Taran Vohra 7675c2c411 use getPublishedContentSite API (#2570)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-11-15 09:21:08 +01:00
Brett Jephson 7c71363af8 Set adjustFallbackFont to false for mono font (#2569) 2024-11-12 13:03:25 +00:00
Steven H d48926eb2a Fix an issue where the space dropdown was shown under the site sections in Safari. (#2567) 2024-11-05 11:49:33 +00:00
Steven H d843e5e06f Fix an issue where the space dropdown could appear behind the header. (#2566) 2024-11-05 09:47:32 +00:00
Steven H a2e564738e Fix the styling of site section tabs on smaller screens. (#2565) 2024-11-04 17:36:10 +00:00
Greg Bergé 54a797a0b1 Nested list support (#2562) 2024-10-31 14:02:42 +01:00
Amrit Kahlon a78c1ecb4d Bump scalar api client package (#2563) 2024-10-30 11:45:56 -07:00
Amrit Kahlon 4771c78001 Fix Scalar ApiClient routing (#2561) 2024-10-28 12:38:18 -07:00
Samy Pessé b7a5106f36 Disable logs for cache-do (#2560) 2024-10-27 08:16:56 -04:00
Samy Pessé 4bcbdc50ff Output caching headers on RSC/prefetch responses (#2559) 2024-10-26 10:57:52 +02:00
Brett Jephson 5d72b35c7f Improve animation of section tabs (#2553) 2024-10-25 14:00:27 +01:00
Amrit Kahlon ff50ac215c Bump @scalar/api-client-react version (#2555)
Co-authored-by: taranvohra <taranvohra@outlook.com>
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-10-25 12:06:49 +05:30
Samy Pessé 3fe3809416 Version Packages (#2415)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-24 15:54:23 +02:00
Samy Pessé 363d337a72 Cleanup GitHub workflows (#2554) 2024-10-24 14:50:39 +02:00
Amrit Kahlon f89b31c940 Upgrade to the new scalar client (#2539)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-10-24 14:40:33 +02:00
Samy Pessé 630c3e84dd Migrate to cloudflare/wrangler-action for deployment (#2549) 2024-10-24 14:30:13 +02:00
Samy Pessé d43202f137 Reduce bundle size of shiki (#2551) 2024-10-24 10:16:56 +02:00
Scott Cazan 0964043489 Use updated endpoint for page feedbacks (#2548) 2024-10-24 10:16:46 +02:00
Taran Vohra e9b31a545d Unify section tab styles with page item styles (#2552) 2024-10-24 13:28:15 +05:30
Greg Bergé 7f28a88374 Use transparent bg for secondary button (#2545) 2024-10-24 06:51:39 +02:00
Steven H 07ea45bf84 Remove deprecated synced block from GitBook Open (#2546) 2024-10-23 15:45:31 +01:00
Zeno Kapitein a86d35f721 Fixes variant selector for sites without variants (#2544) 2024-10-22 17:22:07 +02:00
Zeno Kapitein d6c28a0ff6 Update header styling of sections, variant selector, and button links (#2543) 2024-10-22 16:58:27 +02:00
Brett Jephson a7af3ca7bc Improving the new tabs (#2537) 2024-10-21 19:15:22 +01:00
Taran Vohra cda08a9843 Add support for search in a sections site (#2541) 2024-10-21 15:54:29 +05:30
Taran Vohra 7588774237 add all mode while searching site content (#2540) 2024-10-21 12:13:00 +05:30
Greg Bergé 683373b263 Fix CLS and others (#2536) 2024-10-20 12:55:37 +02:00
spastorelli 673ec8fb5d Update Placeholder ad & Sponsored by GitBook links (#2538) 2024-10-19 08:51:22 +02:00
spastorelli 63bacaa671 Ensure pending or in-review sites still get placeholder ads even without preview query param (#2535) 2024-10-18 17:08:54 +02:00
Samy Pessé e3a3d6a505 Improve perf perception and fix flickering in Ask answer (#2534) 2024-10-18 15:53:57 +02:00
Taran Vohra 175171dda1 Add siteSectionId to lookup result (#2533) 2024-10-18 16:53:15 +05:30
Taran Vohra a4b63b88c8 generate upto URL with 4 segments to support sites with sections (#2532) 2024-10-18 16:34:25 +05:30
Steven H c3675fdfe7 Add support for reusable content (#2531) 2024-10-18 10:59:46 +01:00
Brett Jephson 2fa08519b6 RND-5227: Site section tabs (#2530) 2024-10-18 09:47:53 +01:00
spastorelli 065627060b Show placeholder ad when site ads status is pending or in-review (#2529) 2024-10-17 19:20:34 +02:00
Greg Bergé 2982b6a808 Implement Stepper (#2528) 2024-10-17 09:52:45 +02:00
Greg Bergé c3f56ecd40 Return null if block not handled (#2527) 2024-10-16 22:12:54 +02:00
Zeno Kapitein fe9e6c1afd Update ogimage with new design (#2517)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-10-15 17:28:37 +02:00
Taran Vohra 73394ae929 Mock data for getSpaceCustomization and getSpaceIntegrationScripts (#2522) 2024-10-15 15:40:05 +05:30
Zeno Kapitein c754fc9ff4 Add automatic color contrast in site header, restyle search button (#2512) 2024-10-15 11:05:25 +02:00
Zeno Kapitein 1ca6208057 Update Playwright test for share links (#2523) 2024-10-15 10:53:58 +02:00
Greg Bergé cdfae4d4df Remove custom types for HeaderLink (#2521) 2024-10-14 13:33:01 +02:00
Samy Pessé c3da5469ca Add basic support for computed pages types (#2520) 2024-10-14 10:04:12 +02:00
Taran Vohra 79f2d8ba76 Refactor getContentPointer usage into getSiteContentPointer (#2519) 2024-10-14 12:07:14 +05:30
Taran Vohra 7b1bdb92a6 Remove getContentPointer usage from search (#2516) 2024-10-14 10:26:14 +05:30
Taran Vohra f9a075eed1 add support for sites in multi id mode (#2514) 2024-10-11 15:23:38 +05:30
Greg Bergé 32e4193557 Implement header link style (#2513) 2024-10-09 15:25:47 +02:00
Zeno Kapitein 133c3e7c0a Update Checkbox component (#2511) 2024-10-08 11:02:51 +02:00
Samy Pessé 6ce3cea682 Stop using KV cache backend for now, but also improves it for higher performances (#2510) 2024-10-03 15:46:58 +02:00
Greg Bergé 250e77d18b Fix synced blocks display (#2508) 2024-10-03 10:30:21 +02:00
Addison e3bfe006e9 Add badges section to readme (#2507) 2024-10-02 18:15:37 +09:00
Taran Vohra 76aeecdc68 Remove /v/ from e2e tests (#2505) 2024-10-01 12:04:08 +05:30
Samy Pessé 15d2ee3e76 Show captions for file blocks (#2506) 2024-09-30 17:54:25 +02:00
Taran Vohra b066db479f Bump the cache key for api.getPublishedContentByUrl (#2502) 2024-09-30 15:04:30 +02:00
Samy Pessé a69ff2789a Fix locationHint not being passed when purging the cache (#2504) 2024-09-30 14:45:17 +02:00
Taran Vohra 4df235d64a Add more visitor auth cookie combinations with /v/ for backwards compatibility (#2503) 2024-09-30 17:33:33 +05:30
Taran Vohra 11524457e3 URL alternative resolution criteria (#2497) 2024-09-30 14:18:44 +05:30
Addison 8f7364293e Update Documented on GB badge from encoded to uploaded icon (#2501) 2024-09-30 15:44:45 +08:00
Samy Pessé 56f5fa1fbe Lower usage of KV cache to 30% of tags (#2500) 2024-09-29 10:31:27 +02:00
Samy Pessé b075f0f7e9 Switch to aria-current="page" for the TOC items (#2499) 2024-09-27 12:54:11 +02:00
Samy Pessé 0ca32afe8d Lower usage of KV cache to 60% of tags (#2498) 2024-09-27 11:46:15 +02:00
Samy Pessé 32c2f257a9 Lower usage of KV cache to 80% of tags (#2496) 2024-09-26 19:28:25 +02:00
Brett Jephson a7066ccbe1 Fix: mobile navigation scroll (#2486)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-09-26 14:42:09 +01:00
Taran Vohra 09248e0efe Revert "generate upto URL with 3 segments to support the new site url format" (#2494) 2024-09-26 18:29:01 +05:30
Taran Vohra e2ef22fc5f generate upto URL with 3 segments to support the new site url format (#2493)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-09-26 17:16:22 +05:30
Samy Pessé 75f825e4f8 Disable KV cache for 5% of the cache tags (#2490) 2024-09-26 10:23:25 +02:00
Samy Pessé 9b8d5198e4 Experiment with lower DO billable duration by using direct RPC methods (#2492) 2024-09-25 23:57:43 +02:00
Samy Pessé e09f747727 Refresh change request cache when click refresh button (#2489) 2024-09-25 16:15:42 +02:00
Samy Pessé 16e6171750 Cache embeds for faster rendering (#2488) 2024-09-25 13:33:40 +02:00
Samy Pessé f885e887ea Improve change request previews: consistency and toolbar (#2487) 2024-09-25 12:54:15 +02:00
Samy Pessé 5096f7fbc5 Disable KV cache for docs.gitbook.com and change requests (#2485) 2024-09-25 11:53:53 +02:00
Brett Jephson f16560c1ee Scroll offset (#2484) 2024-09-25 08:52:44 +01:00
Samy Pessé d0f4860759 Refresh icons urls to purge cache of 500 (#2483) 2024-09-24 18:16:35 +02:00
Samy Pessé 34d36c6de1 Fix next-on-pages configuration for ~gitbook/static (#2482) 2024-09-24 17:25:58 +02:00
Brett Jephson 042b850b5d RND-2147: automatically scroll TOC (#2478) 2024-09-24 16:24:55 +01:00
Samy Pessé 73892f4fc2 Fix release preview CI workflow (#2481) 2024-09-24 13:13:45 +02:00
Samy Pessé 636b868bf1 Experimental new cache backend powered by DO (#2479)
Co-authored-by: Johan Preynat <johan.preynat@gmail.com>
2024-09-24 12:55:49 +02:00
Addison b144368e3f Update Dutch "Ask or Search" terminology to fit on one line (#2480) 2024-09-24 16:30:30 +09:00
Scott Cazan 683b4193d1 Don't use customized site title for space in search selector (#2367) 2024-09-23 12:43:03 +02:00
Samy Pessé f4c953665a Optimize layout shift while transitioning between pages with full width blocks (#2477) 2024-09-23 06:19:49 +02:00
Samy Pessé 0f990c772a Show definition title when visible in cards (#2476) 2024-09-22 19:04:23 +02:00
Samy Pessé 0bf985af61 Don't show hidden pages in the empty state of a page (#2475) 2024-09-19 15:17:13 +02:00
Samy Pessé 42473611d3 Add required query parameters to the code sample (#2474) 2024-09-19 14:31:22 +02:00
Samy Pessé 2c437f7d94 Fix linking to tabs itself (#2473) 2024-09-19 10:52:34 +02:00
vibhanshub aa8c49eb0c Display pattern if available in OpenAPI params (#2461)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-09-19 09:59:10 +02:00
Samy Pessé b32e40c72a Persist state of tabs and dynamically sync them based on title (#2472) 2024-09-19 09:40:54 +02:00
Samy Pessé 2ff7ed1b52 Hide button on mobile to open toc if disabled at the page level (#2471) 2024-09-18 19:49:02 +02:00
Samy Pessé bfbed1a69b Use translation for "Sponsored via GitBook" (#2469) 2024-09-17 13:41:53 +02:00
Samy Pessé ef9d012be9 Fix generation of icons package and add task "clean" (#2470) 2024-09-17 13:41:18 +02:00
Nichlas f12a2155c0 Added the Norwegian language (#2467)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-09-17 12:15:21 +02:00
Taran Vohra 43f696c4a8 use samesite none for tracking cookie (#2299) 2024-09-17 11:57:28 +05:30
Samy Pessé 4c19014dcd Prevent robots indexation for pages where it's disabled (#2464) 2024-09-13 13:52:15 +02:00
Samy Pessé 0e7f9d6778 Fix TS error when adding support for a locale not yet supported by API (#2465) 2024-09-13 10:30:20 +02:00
Rens Reinders 00a0bf3c1b Add Dutch Locale support (#2450) 2024-09-13 10:12:44 +02:00
Brett Jephson e9149036f6 RND-3387: synchronize response tabs (#2457)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-09-12 11:01:29 +01:00
Addison b6a9967959 Update search/ask wording for Japanese localization to fit UI better (#2462) 2024-09-12 09:58:58 +02:00
Addison 8bbc3caf3e Update Readme & Contributing Guide (#2459) 2024-09-09 15:28:19 +02:00
Samy Pessé 237b703a6c Fix crash in OpenAPI block because of undefined examples (#2458) 2024-09-06 16:55:04 +02:00
vibhanshub cf3045a718 Add Python support in code samples (#2453) 2024-09-06 14:29:50 +01:00
vibhanshub a679e7283f Render mandatory headers in the code sample (#2445) 2024-09-06 13:24:52 +01:00
Samy Pessé 13c75341e2 Use ellipsis and fix icon color for more links in the header on small screen (#2455) 2024-09-06 11:57:42 +02:00
Marc Laventure 4cbcc5bb20 fix: rollback scalar (#2454)
Co-authored-by: Brett Jephson <brett@gitbook.io>
2024-09-06 10:32:33 +01:00
Brett Jephson 51955dae3b Response examples with status code tabs (#2448) 2024-09-06 09:35:43 +01:00
Brett Jephson 51fa3ab2c8 Use content-visibility on open api operations (#2451) 2024-09-05 17:21:42 +01:00
Samy Pessé af9e66e87e Only display spaces dropdown in compact header when site is multi-variants (#2447) 2024-09-03 19:49:05 +02:00
Samy Pessé 8878dc7f80 Accept special ip headers from gitbook backend (#2446) 2024-09-03 16:47:51 +02:00
Scott Cazan 4336bc20e0 Filter out short searches less then 2 chars, bigger debounce (#2440) 2024-09-03 14:49:35 +02:00
Samy Pessé 4a7613a521 Fix community ads fetching (#2444) 2024-09-03 13:54:31 +02:00
Samy Pessé 689f55340f Fix inconsistent click area in table because of scroll indicator (#2443) 2024-09-02 14:58:56 +02:00
Taran Vohra 160ae3d49d Add spaces dropdown to CompactHeader component (#2439) 2024-08-28 10:08:25 +05:30
Marc Laventure c079c3c6d9 chore: bump scalar package (#2421)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-08-21 08:27:22 +02:00
Samy Pessé cb782a7557 Fix running GitBook locally and fix community ad rendering (#2437) 2024-08-20 19:37:33 +02:00
Abhishek 502d8fc087 Fix typo in README.md (#2430) 2024-08-20 14:55:46 +02:00
Brett Jephson 6295881138 RND-3373: update the shadow for dark mode in multi-space search (#2436) 2024-08-20 13:54:28 +01:00
Brett Jephson 17f71ba680 RND-3113: expand when expandable anchor (#2435) 2024-08-20 11:04:00 +01:00
Brett Jephson 5fe7adb87b RND-3532: drop down menu for hidden links at small screen size (#2434) 2024-08-19 11:51:48 +01:00
spastorelli 41684d091b Revert "Automatically scroll to the active page in table of contents (#2425) (#2429) 2024-08-15 16:52:27 +02:00
spastorelli 9f6c3347cb Automatically scroll to the active page in table of contents (#2425) 2024-08-15 11:42:48 +02:00
Samy Pessé aa321989c4 Use a <div> instead of <h1> in the top header (#2428) 2024-08-14 10:02:42 +02:00
Samy Pessé 0f1565cb4b Fix mermaid / contentkit webframe not updating properly (#2427) 2024-08-13 15:26:11 +02:00
Samy Pessé 3996110ebd Optimize and resize images in community ads (#2426) 2024-08-09 15:41:35 +02:00
Samy Pessé 3422ad4c84 Iteration on community ads (#2422) 2024-08-09 12:31:36 +02:00
spastorelli 3c07e65b9a Fix paragraph top margin in quote blocks (#2423) 2024-08-09 10:58:20 +02:00
Steven H 287df91661 Add an nvmrc file (#2405) 2024-08-07 15:32:08 +01:00
Samy Pessé 776bc3135a Fix running repository without access to Pro token for @gitbook/icons (#2417)
Co-authored-by: Valentino Hudhra <2587839+valentin0h@users.noreply.github.com>
2024-08-02 18:40:44 +02:00
Samy Pessé 4638958c9f Fix preview of customization (#2418) 2024-08-02 18:24:41 +02:00
Samy Pessé 1f24fe46c4 Add support for page icons and icons style customization (#2416) 2024-08-02 17:28:32 +02:00
Valentino Hudhra ccbcab8822 Control tracking of page views with env/header variables (#2380) 2024-08-02 16:10:28 +02:00
Marc Laventure 094e9cdac2 chore: bump scalar (#2410)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-08-02 10:24:39 +02:00
Samy Pessé 5c35f36b3a Prepare @gitbook/icons package and use it as a replacement of geist/icons (#2404) 2024-08-02 09:59:44 +02:00
Steven H d7ec2b57a4 Bump getPublishedContentByUrl cache to fix a recent issue with the GitBook API (#2414) 2024-08-01 06:54:09 +01:00
Steven H 373a1e0312 Bump URL resolution caches after a recent hotfix. (#2412) 2024-07-29 14:22:20 +01:00
Taran Vohra e9fe3975bb Pass shareKey as context while fetching space (#2409) 2024-07-26 16:14:20 +05:30
Samy Pessé 32a73b55d4 Version Packages (#2403)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-25 15:12:18 +02:00
Samy Pessé 0426312d6c Reset to first tab when tabs change in an InteractiveSection (#2407) 2024-07-25 15:09:21 +02:00
Samy Pessé ede2335fb3 Fix x-codeSamples: false not working at the single operation level (#2408) 2024-07-25 14:59:30 +02:00
Amrit Kahlon 709f1a1ccb Update Scalar Api Client to new version (#2406)
Co-authored-by: marclave <marc@scalar.com>
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-07-25 10:25:50 +02:00
Samy Pessé 24b785cbfb Update shiki to fix diff code highlighting (#2338) 2024-07-25 09:33:42 +02:00
Samy Pessé acc3f2f418 Fix Scalar proxy failing on Cloudflare (#2402) 2024-07-24 11:41:35 +02:00
Scott Cazan d4a653d6a9 Use SpaceURL in getURL function to for cross-space searches (#2399) 2024-07-23 12:07:32 +02:00
Samy Pessé 7e74d25447 Version Packages (#2397)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-22 16:26:53 +02:00
Samy Pessé 3445db41ce Fix packages not including all files (#2396) 2024-07-22 16:20:06 +02:00
Samy Pessé d1bd02a6f5 Version Packages (#2395)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-22 15:43:27 +02:00
Samy Pessé 24cd72e088 Use a personal token for the changeset GitHub workflow (#2394) 2024-07-22 15:30:11 +02:00
github-actions[bot] 47f7558c38 Version Packages (#2393)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-22 15:05:57 +02:00
Samy Pessé de747b7b33 Better structure monorepo and publish JS files for react-openapi and react-math (#2392) 2024-07-22 15:02:04 +02:00
Samy Pessé 8e8b73fbd9 Publish packages as public with changeset (#2391) 2024-07-21 21:25:43 +02:00
github-actions[bot] e966e33e8f Version Packages (#2390)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-21 19:45:18 +02:00
Samy Pessé bd0ca5babd Fix @gitbook/react-openapi when react import are mandatory (#2389) 2024-07-21 19:43:50 +02:00
Samy Pessé f6bacea1ae Skip hidden pages in sitemap.xml (#2388) 2024-07-19 09:20:16 +02:00
github-actions[bot] ba2a523722 Version Packages (#2387)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-19 08:28:14 +02:00
Samy Pessé 57adb3e54a Fix publish with changeset (#2386) 2024-07-19 08:23:03 +02:00
github-actions[bot] 7377928c8a Version Packages (#2385)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-18 21:05:22 +02:00
Samy Pessé 5f8a8fe9b1 Setup Changeset to publish packages to NPM (#2384) 2024-07-18 21:00:50 +02:00
Scott Cazan 29a0bf25c4 Update Site search endpoint (#2382)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-07-18 10:36:12 +02:00
spastorelli 92bb016576 Show additional context when linking to a page group & a page in another space (#2381) 2024-07-18 10:22:15 +02:00
Samy Pessé c8810ea002 Hide pages from table of contents when set as hidden (#2383)
Co-authored-by: Scott Cazan <scottcazan@gmail.com>
2024-07-18 09:50:46 +02:00
spastorelli aa8bbaddc4 Fallback redirect to root when switching variants (#2376) 2024-07-16 09:24:31 +02:00
Samy Pessé b8c136e9c0 Fix render of one of when alternatives are primitives (#2378) 2024-07-15 10:15:42 +02:00
Samy Pessé 46d54172b0 Fix CI step to verify formatting (#2379) 2024-07-14 23:53:55 +02:00
Brett Jephson 68dc2de190 Remove Page/Space label from BlockContentRef (#2374) 2024-07-12 15:02:05 +01:00
Samy Pessé 81b372f372 Fix response example when response example is a string (#2377) 2024-07-12 10:35:22 +02:00
Scott Cazan 966e520640 Fix Source links in Ask AI not navigating to the page (#2375) 2024-07-11 15:39:28 +02:00
spastorelli 12702930ec Optimize SpacesDropdownMenuItem client side props (#2373) 2024-07-11 10:42:53 +02:00
spastorelli 6ce57bcda1 Fix issue where nav route/path is not retained when switching variants (#2372) 2024-07-10 17:10:19 +02:00
spastorelli d99b453bc4 Fix issue where published content crashes when localstorage is disabled (#2371) 2024-07-10 14:56:21 +02:00
Samy Pessé aaf5793cb7 Use schema.example if defined, even if value is falsy (#2370) 2024-07-05 16:34:48 +02:00
Samy Pessé 9b1762d2ab Fix invalid api response from carbon (#2369) 2024-07-05 15:55:35 +02:00
Samy Pessé 8d38d000fd Fix RND-4344 (#2368) 2024-07-04 17:04:35 +02:00
Scott Cazan 4cf9cdd56d Fix ToC not re-rendering when linking to a variant from SearchResults (#2366) 2024-07-03 12:22:08 +02:00
Scott Cazan 39406bbf54 Use published URL for site when displaying results for a Site space (#2364) 2024-07-02 16:14:39 +02:00
Scott Cazan 9c5c1e5b68 Show sources with no answer (#2363)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-06-28 15:25:01 +02:00
Johan Preynat 6929b0b98b Prevent SVG images to be resized and rendered on the /~gitbook/image endpoint (#2362) 2024-06-27 12:24:46 +02:00
Johan Preynat 7c26d491b1 Fix passing the correct nonce for iframely script and preload it (#2360) 2024-06-25 17:11:19 +02:00
Johan Preynat 97035a054a Tree shake unused code for Sentry (#2359) 2024-06-25 15:55:48 +02:00
Johan Preynat db45c6d773 Rework context to actually share memory cache between middleware and handlers for all requests (#2358) 2024-06-25 14:30:38 +02:00
Johan Preynat e3f5f81e62 Use fnv1a instead of SHA256 to create images signatures (#2353) 2024-06-24 13:31:18 +02:00
Johan Preynat f5df40e17d Use a singleton to store the memory cache in an internal WeakMap for the current request (#2356) 2024-06-24 11:13:03 +02:00
Johan Preynat e13c76efed Set preconnect links to main domains on render (#2354) 2024-06-21 17:02:02 +02:00
Johan Preynat 4a11d8d9eb Share memory cache between middleware and request handler (#2347) 2024-06-21 11:13:06 +02:00
spastorelli 009ed8cc6e Call trackViewInSiteById API endpoint when tracking view for sites (#2350) 2024-06-21 10:01:35 +02:00
vibhanshub 106cbbd987 Add support for examples in OpenAPI block (#2314) 2024-06-20 16:02:58 +05:30
Johan Preynat 56e5c3c3f8 Parse cache tags returned from the API set them in response (#2349) 2024-06-20 10:09:02 +02:00
Taran Vohra 1dc3234003 Fix page metadata title (#2348) 2024-06-18 20:52:12 +05:30
Johan Preynat 22dc0d4ff5 Fix passing revalidateBefore option when calling cacheResponse to ensure these go through background revalidation (#2342) 2024-06-17 17:16:12 +02:00
Taran Vohra 3a4caf062c Add getContentTitle to properly render the title for sites & legacy published content (#2343) 2024-06-17 20:28:21 +05:30
Taran Vohra 8ad0657159 Use site's share key as context while fetching site spaces (#2341) 2024-06-14 20:59:05 +05:30
Taran Vohra d8a4ecd0c6 Pass site url as context to listSiteSpaces API (#2339) 2024-06-14 10:40:18 +05:30
David Burghoff 65c7968438 Add German Locale support (#2317)
Co-authored-by: David Burghoff <david.burghoff@swot.de>
Co-authored-by: taranvohra <taranvohra@outlook.com>
2024-06-13 15:04:49 +02:00
Rodrigo Castro 3914f11150 Add Brazilian Portuguese translation (#2285)
Co-authored-by: taranvohra <taranvohra@outlook.com>
2024-06-13 14:54:47 +02:00
Addison d363908297 Add contributors to readme, bump API (#2333) 2024-06-12 15:24:18 +02:00
Greg Bergé 414556ac7a Remove cache client-side (#2337) 2024-06-10 11:17:48 +02:00
Steven H c768e9a90a Add another space to ignore list whilst we debug issues. (#2334) 2024-05-28 19:02:07 +01:00
Taran Vohra 553f1f228f Bump @gitbook/api to 0.48.0 (#2328) 2024-05-24 20:10:25 +05:30
Taran Vohra 30986528a7 bump @gitbook/api to 0.47 (#2327) 2024-05-24 19:07:54 +05:30
Steven H c70c2ddad8 Bump next-on-pages version to fix SSRF attack. (#2319) 2024-05-16 17:05:58 +01:00
Marc Laventure cf74d00758 chore: update scalar client (#2316) 2024-05-14 11:52:09 -07:00
Steven H c2256bfd14 Fix an issue where attackers could use the Nextjs image endpoint to redirect to any URL. (#2312) 2024-05-14 11:34:33 +01:00
fuyangpengqi 5d73a0f062 chore: fix some typos in README.md (#2290)
Signed-off-by: fuyangpengqi <995764973@qq.com>
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-05-13 16:22:07 +02:00
Samy Pessé 8f5f6c61f8 Setup the pull_request workflow on actions (#2311) 2024-05-13 16:10:15 +02:00
Taran Vohra 9a86965ba1 Fix VA cookie to be only set if basePaths match (#2300) 2024-05-06 21:02:48 +05:30
Scott Cazan c8d5f825fc Update GitBook trademark (#2305) 2024-05-02 12:18:02 +02:00
Steven H 5db3cbc2ce Render Embed blocks that can be handled by an integration in the Space. (#2302) 2024-04-25 15:25:53 +01:00
Steven H f8d148bec4 Use plain code highlighting on some spaces that are currently crashing. (#2301) 2024-04-25 09:50:08 +01:00
Steven H 198dd9f158 Investigate an issue where images with 127.0.0.1 in the URL are not correctly resolved. (#2298) 2024-04-19 17:21:22 +01:00
Steven H 2b63bc158a Improve rendering of File column in tables. (#2297) 2024-04-19 16:58:46 +01:00
spastorelli 4a8097d968 Use site space context from token in multi-id mode when provided (#2295) 2024-04-19 16:51:12 +02:00
spastorelli f1440ca7ef Fix preview crashing when token do not include site data (#2292) 2024-04-18 17:36:16 +02:00
Taran Vohra 7ef2eeed13 fix site cache tag to exclude org id (#2291) 2024-04-18 20:28:39 +05:30
Taran Vohra 4005895337 Fix previews for sites in multi-id mode (#2289) 2024-04-18 18:19:52 +05:30
Steven H bf450e5cc7 Support GitHub-flavoured Markdown when parsing OpenAPI descriptions. (#2288) 2024-04-17 14:21:07 +01:00
Taran Vohra 4c12722c0a Use appropriate customization settings for sites (#2279) 2024-04-17 17:28:14 +05:30
Taran Vohra ac124a7ea5 Add e2e tests for site variants (#2286) 2024-04-16 20:59:58 +05:30
spastorelli 1de25056fa Fix space dropdown showing for single variant sites and update E2E tests (#2284) 2024-04-16 15:29:15 +02:00
Steven H bf3d2032ab Avoid crashing Cloudflare Worker when syntax highlighting too many lines of code. (#2283) 2024-04-15 11:57:22 +01:00
spastorelli bfb2342ab3 Add support for integration inject script for sites (#2277) 2024-04-11 10:28:24 +02:00
Samy Pessé 76cbc3c10f Print signature and url when having error with image resizing (#2275) 2024-04-09 11:22:36 +02:00
Taran Vohra c80c76d50d Override site's spaces published URLs (#2274) 2024-04-09 09:59:25 +05:30
Johan Preynat 263c89391e Add HSTS and other security headers (#2271) 2024-04-08 19:44:57 +02:00
Samy Pessé ebf742e81a Use a sampleRate of 0.1 for edge/node runtimes (#2273) 2024-04-08 15:05:01 +02:00
Samy Pessé 685317f508 Fix full-width for code-blocks and embeds (#2272) 2024-04-08 14:45:42 +02:00
Taran Vohra 0c224861e3 Sites support (#2262) 2024-04-08 17:06:22 +05:30
Steven H a007604ab1 Bump caches for documents. (#2265) 2024-04-04 14:09:43 +02:00
Steven H 3076e96061 Fix an issue where OpenAPI blocks could not be fetched. (#2267) 2024-04-04 12:28:30 +02:00
Steven H a3741dd65f Bump caches for revisions. (#2263) 2024-04-04 11:15:29 +02:00
Taran Vohra 07085a5b89 Set tracking prompt cookie age to 365days instead of a session cookie (#2266) 2024-04-04 14:39:27 +05:30
Samy Pessé 36600bc0c7 Fix styling for cards when no cover is defined (#2261) 2024-04-03 00:10:59 +02:00
Samy Pessé 5b7488b066 Handle ?theme query string to force theme in preview mode (#2260) 2024-04-02 13:55:27 +02:00
Samy Pessé c1ef7f2782 Fix display of parameter's description in OpenAPI block (#2258) 2024-04-02 00:35:59 +02:00
Samy Pessé f26ab0cf80 Remove mask on page cover (#2257) 2024-04-02 00:21:21 +02:00
Samy Pessé 7c570a008e Use a sample rate of 10% for Sentry errors (#2256) 2024-04-01 23:07:43 +02:00
Samy Pessé 1d71d85ed7 Don't test redirect on path that are longer than 512 (#2255) 2024-04-01 02:49:48 +02:00
Samy Pessé 4f728c0137 Fix parsing of Swagger 2.0 when it can be patched (#2254) 2024-03-31 20:13:34 +02:00
Samy Pessé 844a3e1845 Fix search in collection spaces leading to invalid urls (#2253) 2024-03-31 18:03:24 +02:00
Steven H 3144b2fec1 Update SyncedBlocks to use new API (#2251) 2024-03-29 15:57:08 +00:00
Samy Pessé 5805c24255 Fix copy for code blocks in OpenAPI or AI answers (#2250) 2024-03-28 22:46:29 +01:00
Samy Pessé d0ef225ea3 Make click on OpenAPI property name selects the entire text (#2249) 2024-03-28 22:44:03 +01:00
Samy Pessé 5f1d82cb5a Fix rendering of select in cards (#2248) 2024-03-28 20:53:01 +01:00
Samy Pessé 0894a740ff Fix crash when "required" is not an array in OpenAPI schemas (#2247) 2024-03-28 17:03:30 +01:00
Samy Pessé 14012d92f9 Fix cover image overflowing the card (#2243) 2024-03-27 18:20:16 +01:00
Samy Pessé 4be6eada62 Fix redirect to right page for content redirects (#2241) 2024-03-26 23:30:47 +01:00
Samy Pessé 0ddbe5c0ee Revert crossOrigin="anonymous" for images (#2240) 2024-03-26 23:19:20 +01:00
Samy Pessé 3a7864d731 Fix design of embed cards being centered (#2239) 2024-03-26 18:29:52 +01:00
Samy Pessé 73d806a796 Set z-index on annotation popover (#2238) 2024-03-26 16:46:19 +01:00
Samy Pessé d40568c8f4 Fix OpenAPI tag in aside when text is long (#2237) 2024-03-26 14:02:17 +01:00
Samy Pessé a6789513dc Fix alignment and border around small images in a grid with captions (#2229) 2024-03-26 13:45:23 +01:00
Samy Pessé ee7a74fe43 Fix VA redirects for nested paths (#2236) 2024-03-26 11:53:32 +01:00
Samy Pessé 0d99906774 Fix crash with concurrent loading of shiki syntaxes (#2235) 2024-03-26 11:30:38 +01:00
Greg Bergé d3f9131af4 Support images & files in synced blocks (#2234) 2024-03-25 21:53:24 +01:00
Addison 30bae7c877 Add legacy references to readme (#2233) 2024-03-25 13:49:39 +01:00
Samy Pessé 0c99a57b3c Also fix crossOrigin for images when zooming it (#2232) 2024-03-25 13:43:19 +01:00
Samy Pessé ad9e8f2232 Fix authentication displayed for images (#2231) 2024-03-25 13:15:19 +01:00
Greg Bergé 4c286b503c Fix fullPage screenshots (#2230) 2024-03-25 12:43:50 +01:00
Samy Pessé c5a28f884a Fix zoom on small images with custom zoom component (#2228) 2024-03-25 11:31:40 +01:00
Samy Pessé 2ed5445af8 Fix display of cover when TOC is hidden (#328)
* Add visual tests for page options

* Fix the case of a landing page

* Fix height of the aside when page has a cover

* Remove some visual tests
2024-03-22 23:46:35 +01:00
Samy Pessé 755291d1b7 Fix redirect for uppercased pathnames and fix og:image for collections (#327)
* Fix redirect for uppercased pathnames

* Try fixing it

* Try without metadataBase

* New try

* Fix it

* Try to fix og:image

* Generate canonical URL meta tag
2024-03-22 22:23:11 +01:00
Samy Pessé 7421d1c6c3 Cache getPublishedContentByUrl by tags (#326)
* Cache getPublishedContentByUrl by tags

* Reduce amount of cases returned by getURLLookupAlternatives

* Optimize lookup even more for revisions / change-requests

* Fix basePath for revisions / crs
2024-03-22 21:10:58 +01:00
Samy Pessé ff773233dd Prevent click on images in links to zoom it (#324)
* Prevent click on images in links to zoom it

* Fix TS
2024-03-22 16:56:08 +01:00
Samy Pessé 44983f8495 Minor perf improvements to code block highlighting (#323)
* Use a singleton map when loading languages

* typing

* Lint

* Remove one trace
2024-03-22 16:43:22 +01:00
Viktor Renkema 435ccb10ce Fix tab truncation behaviour (#322) 2024-03-22 12:18:49 +01:00
Amrit Kahlon ef8eb72364 fix: clear scalar api client response on close (#318)
* fix: clear scalar api client response on close

* bun install

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-03-21 14:53:29 +01:00
Samy Pessé 2a28f28421 Fix some links opening in new tab and links on blankslate (#321)
* Open links from TOC in same tab

* Fix page blankslate not resolving page links correctly
2024-03-21 14:11:42 +01:00
Samy Pessé be45f23cc8 Use whitespace-pre to fix whitespace in highlighted text in search (#320)
* Use whitespace-pre to fix whitespace in highlighted text in search

* Correctly fix it
2024-03-21 13:10:58 +01:00
Brett Jephson fff6dce8fc RND-3192: images expanding card content beyond their width (#281)
* Fix for RND-3192: images expanding card content beyond their width

* Wrap Image in a size-restricting container

---------

Co-authored-by: Viktor Renkema <vrenkema@gmail.com>
2024-03-21 12:46:46 +01:00
Samy Pessé cfcfbdf16c Fix text/image alignment in cards (#319)
* Add a visual test

* Fix test
2024-03-21 12:15:58 +01:00
Samy Pessé b029b1e23d Fix display of advanced blocks in OL/Tasks lists (#317)
* Fix OL list style

* Format

* Fix it for tasks lists as well

* Default to fullPage

* Run some test without fullPage

* Run fullPage only on list
2024-03-21 09:50:18 +01:00
Samy Pessé 1dc81fc56a Use absolute URLs in sitemap.xml (#316) 2024-03-20 23:58:57 +01:00
Samy Pessé 31799038dd Improve rendering of complex emojis in favicon (#315)
* Improve rendering of complex emojis in favicon

* Lint
2024-03-20 19:25:42 +01:00
Samy Pessé db4ecbc747 Fix long words in headings breaking the layout (#314) 2024-03-20 18:59:52 +01:00
Samy Pessé 0ad7bf561e Let users extend the limit of PDF generation (#313)
* Add link to extend PDF generation limit

* Translate

* Use variable
2024-03-20 18:49:28 +01:00
Samy Pessé dc2d50e455 Iterate over all keys in KV when purging cache instead of just first page (#312)
* Iterate over all keys in KV when purging cache instead of just first key

* Call getTagPrefix once
2024-03-20 18:48:17 +01:00
Addison 10fc27ba4e Add README, License & Contributing Guide (#153)
* Initial commit, format

* Use codeblocks instead of inline code

* Add header

* Add badge, update placeholder for hero image

* Update badges and structure

* Add license

* Update badges

* Add contributing guide

* Add deployment guide

* Add license section

* Update header image

* Add image of deployed site

* Update readme

* remove deployment buttons

* formatting

* Add types of contributions

* format

* Add review suggestions

* Update badges
2024-03-20 17:26:44 +01:00
Samy Pessé 2e6e96728c Fix logic to parse changeRequest URL in multi-id mode (#311) 2024-03-20 16:50:55 +01:00
Samy Pessé e1de340fc5 Support URL routes to export PDF for a change-request / revision (#310)
* Support more URL patterns for "multi-id" mode

* Format
2024-03-20 15:43:29 +01:00
Samy Pessé fc9238498d Only use GITBOOK_TOKEN when request is using default API (#309)
* Only use GITBOOK_TOKEN when request is using default API

* Format
2024-03-20 10:40:38 +01:00
Samy Pessé 2420f9b730 Return private cache-control when receiving prefetch request (#308) 2024-03-20 00:17:59 +01:00
Samy Pessé d12aad6867 Fix different flickering when navigating in docs (#307)
* Prevent scroll flickering when switching between page with scroll and no scroll

* Oups

* Remove id

* Apply only on large device and use variable

* Fix default
2024-03-19 20:51:16 +01:00
Samy Pessé 37be6f3164 Support options in the OpenAPI spec to control the look and feel (#306)
* Don't show code-samples if x-codeSamples is defined

* Support x-hideTryItPanel to hide "Try it"

* Fix display of code samples
2024-03-19 16:32:15 +01:00
Marc Laventure 4f039ecb2b feat: add scalar api client (#180)
* wip

* feat: add scalar api client

* fix: pr feedback

* feat: add scalar react client package, remove vueary

* feat: add scalar proxy

* Move dependencies to package

* Format once

* Rename prop

* Use react context and simplify lazy loading

* Add loading state

* Format

* Move styles

* bun install

* bun

* fix: remove extraneous api-reference package

* feat: make operation functional with spec in client

* fix: column bug and http request type wrapping

* fix: add scalar api reference package

* Format

* bun install

* fix: scrolling in scalar modal

* Lazy load operations data in component

* fix: change dependency from api-reference to oas-utils to reduce size

* bun install

* Log error in the worker proxy

* Cleanup

* Comment "mode"

* Without credentials and referrerPolicy

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
Co-authored-by: Amrit <amrit@hockey-community.com>
2024-03-19 15:32:54 +01:00
Samy Pessé 71e993d0ca Fix support for page redirects with uppercases (#305) 2024-03-19 14:37:45 +01:00
Samy Pessé 6695de7b79 Fix inline math not displayed with KaTeX (#304)
* Fix mathjax loading

* Fix inline math not being displayed

* Format
2024-03-19 12:39:53 +01:00
Samy Pessé cf958bacd1 Fallback to MathJax when KaTeX fails to compile math (#303)
* Start

* Use MathJax v3

* Format

* Improve font-size

* Lint

* Better handle loading

* Copy MathJax assets to public folder

* Attempt at using local assets for MathJax

* Use bun 1.0.31

* Try with bun 1.0.33

* Try fixing headers

* Simplify

* Simplify and not use suspense module

* Cleanup more

* Add test for Math

* Make math block scroll if needed

* Update packages/react-math/src/KaTeX.tsx

Co-authored-by: Greg Bergé <berge.greg@gmail.com>

* Use React.use

* Format

* Use exports

* Lint

* Disable cache in CI for lint

* Format

---------

Co-authored-by: Greg Bergé <berge.greg@gmail.com>
2024-03-19 11:34:53 +01:00
Samy Pessé 85a32fda4f Wrap RocketLoaderDetector in DOMContentLoaded (#302) 2024-03-18 19:35:31 +01:00
Samy Pessé 706aa42a6e Fix RocketLoaderDetector being encoded (#301)
* Fix RocketLoaderDetector being encoded

* suppressHydrationWarning

* Show alert at the top of the page
2024-03-18 19:14:54 +01:00
Samy Pessé 4dcca8b3ec Pass the nonce to the RocketLoaderDetector (#300) 2024-03-18 18:42:56 +01:00
Samy Pessé d0b92dd408 Improve text displayed in mention for anchor content refs (#287)
* Resolve anchor content reference to the block text for mentions

* Only apply it for mentions/etc, where text is needed

* Handle tabs/expandable

* Rename to resolveAnchorText
2024-03-18 18:16:53 +01:00
Greg Bergé 718452728f Detect Rocket Loader and advert about it on docs (#295) 2024-03-18 17:33:26 +01:00
Greg Bergé 9b6d34bdbc Remove screenshot from AI result (#298)
Not possible to have it stable
2024-03-18 15:53:41 +01:00
Greg Bergé 3c96bf84b5 Upgrade Argos (#296)
* Upgrade Argos

* Wait for cookie dialog, avoid fullPage if not needed

* Fix E2E

* Cookies dialog
2024-03-18 15:30:45 +01:00
Greg Bergé cc4a86cc23 Fix ordered list display (#294)
* Fix ordered list display

* Cover lists in E2E
2024-03-18 15:26:43 +01:00
Greg Bergé c87197bb98 Replace shikiji by shiki (#297) 2024-03-18 15:11:22 +01:00
Valentino Hudhra 69dcf75083 Align loading skeleton with content (#288) 2024-03-18 14:48:40 +01:00
Samy Pessé 66dcaf850f Ignore all errors for rendering integration blocks (#293) 2024-03-18 12:08:49 +01:00
Greg Bergé 5f70ed73b9 Fix page cover display (#291)
* Fix page cover display

Make it always looks good with the recommended size of 1990x480.

* Take maximum size on mobile

* Stabilize visual testing
2024-03-18 11:04:28 +01:00
Samy Pessé bda3080b94 Don't show "Last updated" when no createdAt/updatedAt (#292) 2024-03-18 10:09:05 +01:00
Samy Pessé 9f5c68acfe Fix passing ref to Link elements to make enter in search works (#290) 2024-03-18 09:41:15 +01:00
Samy Pessé df92c72164 Fix resolution of first page document when content starts with empty group (#289)
* Fix resolution of first page document when content starts with empty group

* Lint
2024-03-18 09:23:23 +01:00
Samy Pessé a27fa68ae6 Fix scroll to hash and update next to 14.1.3 (#286)
* Update next to 14.1.3

* Scroll to hash when url changes

* Simplify tests

* Lint and format

* Fix TS

* Dummy comment

* Try async function
2024-03-18 08:55:30 +01:00
Samy Pessé 9e8cde48d4 Fix URL.canParse failing on some browsers (#285)
* Fix call to URL.canParse failing on some browsers

* format
2024-03-15 21:04:05 +01:00
Steven H 9f75929269 Fix an issue where following a link to a different space would not update the ToC or header. (#284)
* Fix an issue where clicking links to other spaces would not update ToC/header

* Fix

* Remove dev text

* Use URL.CanParse for testing the external url

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-03-15 20:09:29 +01:00
Samy Pessé 5c7c17fe02 Fix OpenAPI parsing for Swagger 2.0 YAML anchors (#282) 2024-03-15 18:09:44 +01:00
Johan Preynat 66506143ef Redirect uppercase pages path to lowercase (#273)
* Redirect to lowercase pathname when page path has uppercase

* Also redirect in generateMetadata

* Rollback changes in middleware normalizeURL

* Improve argument type

* Only redirect in page component
2024-03-15 17:01:45 +01:00
Greg Bergé 50346135f9 Refactor image sizing logic (#278)
Fix RND-3140
2024-03-15 16:21:03 +01:00
Steven H f98146f5b6 Show a single page when user clicks Export as PDF (#279) 2024-03-15 15:08:41 +00:00
Steven H 88a7ab21a2 Revert a change in the way we await for local caches to update. (#277) 2024-03-15 14:03:00 +00:00
Steven H a4099dff9e Remove awaiting for local caches to set their values whilst we investigate hanging pages. (#275) 2024-03-15 13:47:31 +00:00
Steven H 98f91d9e82 Reduce local caches to 30s (#274) 2024-03-15 13:34:52 +00:00
Greg Bergé 4c2625c277 Fix memory cache usage, use the same value of 1 min for non immutable in local cache (#272) 2024-03-15 12:37:27 +01:00
Greg Bergé 77b6228677 Fix an issue where we were caching mutable cache entries indefinitely. (#270) 2024-03-15 11:22:15 +00:00
Johan Preynat ff93689d4e Rollbacking lowercasing paths since it breaks share links... (#271) 2024-03-15 12:01:58 +01:00
Steven H d8ffa5d69c Fix an issue where parsing an OpenAPI schema without securitySchemas would crash the page. (#263) 2024-03-15 10:27:23 +00:00
Samy Pessé f77b2b6cd7 Fix resolution of content-refs to pages in another space (#267)
* Fix resolution of content-refs to pages in another space

* Fix title of the content ref
2024-03-15 11:25:23 +01:00
Sebastian Graz 5dec1a1f0e Top links visibility container queries (#257)
* improve top link vis queries & footer style fixes

* add ellipsis to menu items

* Add spacing to menu items

* Remove weird shadow

* Format

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-03-15 11:24:47 +01:00
Johan Preynat e462ac837e Redirect URLs containing uppercase characters to lowercase (#266)
* Add tests for normalizeURL

* Redirect requests containing uppercase in pathname to lowercase via normalizeURL

* Fix typo
2024-03-15 11:24:41 +01:00
Taran Vohra a21673e4c1 use sameSite: none for va cookie (#265)
Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-03-15 15:52:10 +05:30
Johan Preynat c6537422a4 Use bun 1.0.30 for now in CI (#269) 2024-03-15 11:03:37 +01:00
Johan Preynat 654a9e6227 Increase getDocument timeout to 20s to prevent failing while the API is normalizing documents (#264) 2024-03-14 20:35:00 +01:00
Steven H 80d45c3ff7 Force light mode when exporting PDF. (#242) 2024-03-14 16:40:49 +00:00
Steven H 8c75bd364b Revert "Add w-full to consider Cards block (#261)" (#262)
This reverts commit 06b94d4525.
2024-03-14 15:42:06 +00:00
Viktor Renkema 06b94d4525 Add w-full to consider Cards block (#261) 2024-03-14 15:55:25 +01:00
Steven H e5a9d16d7e Mitigate long loading times on spaces with many files. (#260) 2024-03-14 11:41:11 +00:00
Samy Pessé d0eebceacf Batch request for getRevisionFile to avoid too many sub-requests (#259)
* Try approach with batching

* Improve it to support getRevision

* Fix

* Real fix

* Implement skip

* Lint
2024-03-13 18:10:07 +01:00
Steven H ee3221885c Remove Sentry trace/transaction (#258) 2024-03-13 16:35:18 +00:00
Greg Bergé 76dbf0f0d3 Tag synced block in API (#256) 2024-03-13 15:32:52 +01:00
Scott Cazan fc11ffdc8b Don't try to render responses if none are defined by the user (#255)
* don't try to parse responses if none are defined

* don't try to render responses if none exists

* move logic back into component
2024-03-13 14:37:21 +01:00
Steven H 9f83b0e783 Fix an issue where an incorrect cache key was used for revisions and pages, causing 404s and 500s. (#254) 2024-03-13 13:20:57 +00:00
Samy Pessé b0a9361cbd Disable redis cache (#253) 2024-03-13 13:36:38 +01:00
Samy Pessé e34b923e4a Correctly handle errors in blockFallback when inputs are running (#249)
* Correctly handle errors in blockFallback when inputs are running

* Format

* Fix case of steven
2024-03-13 12:54:49 +01:00
Samy Pessé cf4b1249a9 Optimize performances for reading revisions (#251)
* Optimize read of revisions with metadata=false when possible

* Format

* Fix

* Update src/components/AdminToolbar/AdminToolbar.tsx

Co-authored-by: Steven H <shne24@gmail.com>

---------

Co-authored-by: Steven H <shne24@gmail.com>
2024-03-13 12:54:32 +01:00
Samy Pessé 221d85cc4d Optimize caching of revisions/documents (immutable entries) in memory and cloudflare cache (#252)
* Better handle immutable cache entries in memory/cf-cache

* Format

* Update src/lib/cache/utils.ts

Co-authored-by: Steven H <shne24@gmail.com>

---------

Co-authored-by: Steven H <shne24@gmail.com>
2024-03-13 12:54:22 +01:00
Scott Cazan 658eb4d13f extra check for undefined in schema.items (#250) 2024-03-13 12:24:10 +01:00
Samy Pessé 3725239e92 Skip data: images for image resizing (#248) 2024-03-13 11:36:06 +01:00
Samy Pessé bdbd14c560 Fix next edge runtime not liking error in logs (#247)
* Fix next edge runtime not liking error in logs

* Fix other errors
2024-03-13 11:04:43 +01:00
Taran Vohra 0da4e9a926 Fix visitor auth logic by testing multiple basePaths (#239)
* WIP

* add search params to target in multi-path

* Simplify

* Format

* Ensure trailing slash

* Add unit test

* fix lint

* use search from target in redirect

* remove unused import

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-03-13 13:54:47 +05:30
Taran Vohra 1eb4bff09b Strip url search params when comparing in lookupSpaceByAPI (#246)
* strip url search while comparison in lookupSpaceByAPI

* strip URL search for the lookupURL
2024-03-13 13:44:44 +05:30
Samy Pessé 147719c19b Fix testing of VA in local development (#245) 2024-03-13 09:02:35 +01:00
Samy Pessé c13f676ea8 Fix content references to other spaces (#243) 2024-03-12 20:43:07 +01:00
Samy Pessé d326822b9d Pass token to getPublishedContentByUrl to ensure rate-limit settings are propagated (#244) 2024-03-12 20:33:28 +01:00
Samy Pessé 111ec45357 Fix env variable used for API token (#241) 2024-03-12 18:12:49 +01:00
Steven H e39e1db484 Fix an issue where track_view was failing. (#240) 2024-03-12 15:53:58 +00:00
Samy Pessé 6849df49ec Fix error with primary revision being fetched instead of specific one (#236) 2024-03-12 12:03:13 +01:00
Steven H a697dc4fcd Fix an error where a Theme nonce value could cause inconsistencies between server- and client-side rendering. (#237) 2024-03-12 10:09:14 +00:00
Samy Pessé a8d15555c8 Remove custom text selection color (#234) 2024-03-11 18:58:36 +01:00
Samy Pessé 7d53a2c849 Remove colors from HTML root and define them in the tailwind config (#233)
* Remove colors from HTML root and define them in the tailwind config

* Add visual test
2024-03-11 18:50:45 +01:00
Sebastian Graz 270f8b55a5 Hints (#232)
* V1 hint refactor

* checkbox fix

* Update src/components/DocumentView/Hint.tsx

remove comment

Co-authored-by: Samy Pessé <samypesse@gmail.com>

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-03-11 18:28:20 +01:00
Samy Pessé 56a9d5601b Fix cache revalidation in KV and output stats on revalidation (#231)
* Store setAt on cache meta and output stats on revalidation

* Delete from KV cache

* test more

* Improve

* Format

* Store the key in metadata

* Avoid storing too much in KV

* Don't put tag on resolve of url
2024-03-11 13:30:26 +01:00
Samy Pessé ea7ff33f3a Expose publicly cache tags with x-gitbook-cache-tag (#230) 2024-03-11 10:17:44 +01:00
Samy Pessé 642e33444a More immutable cache and pre-revalidation (#229)
* Try different approach

* Revalidate before cache expires

* TS

* Only replicate to local backends

* Ensure revalidate is done only once for the same key

* Improve perf of getCacheKey

* Simplify type

* Use better method and comment

* Use it 7 days only
2024-03-11 09:35:20 +01:00
Samy Pessé 0e858b1a43 Improve span name in sentry for cache (#228)
* Improve span name in sentry for cache

* Better use `trace`

* One more span

* Lint

* Log memory usage

* Reuse span between fetchValue and get
2024-03-09 14:31:23 +01:00
Samy Pessé 510a6f39d7 Fix revalidation and redis get (#226)
* Log

* Try to fix

* Use automaticDeserialization

* Log errors

* Ignore AbortError
2024-03-08 16:38:43 +01:00
Samy Pessé f9e3835c2f Simplify redis cache and remove hits count (#225)
* Simplify redis cache and remove hits count

* Fix naming

* Update src/lib/tracing.ts

Co-authored-by: Steven H <shne24@gmail.com>

---------

Co-authored-by: Steven H <shne24@gmail.com>
2024-03-08 13:05:32 +01:00
Greg Bergé 5a5b4bb93c Replace Puppeteer by Playwright (#224)
* Replace Puppeteer by Playwright

* Remove the limit of workers on ci

* Various fixes after review

* Document things
2024-03-08 10:41:30 +01:00
Samy Pessé 55d1e538d9 More resilient caching and use of KV (#222)
* Add unit tests for "race"

* Reduce to 80s

* Implement a Cloudflare KV cache

* Format

* Lint

* Fix tagging of entries in KV

* No longer use HTTP cache tags

* Simplify tags to only keep 2

* Implement a blockFallback logic

* Improve the block fallback logic

* More tests

* Start introducing a always optional signal on all cache ops

* Correctly pass signal end to end

* Fix one more case and add tests

* Fix it

* Add test for error

* Fix error handling

* Simplify even more

* Improve logs

* Improve logs / measurements

* Fix timing

* Fix read cache duration and add minor tests

* Log redis time

* Change replication logic

* Fix redis errors

* Log more

* More logs and test memory first

* Improve tracing for cache backends

* Ignore all dependencies

* Log the key in the cache low level traces
2024-03-08 09:43:30 +01:00
Greg Bergé 7d04336b5f Support synced blocks (#223) 2024-03-08 09:16:01 +01:00
Samy Pessé 79f420eb8e Add timeout to cache get (#221)
* Add timeout to cache get

* Reduce it to 200ms
2024-03-06 20:12:47 +01:00
Samy Pessé 2742d961ee Remove feedback toast (#217) 2024-03-06 18:27:25 +01:00
Samy Pessé f41b0c7ba1 Fix crash when resolving ref fails in an OpenAPI file (#220)
* Fix crash when resolving ref fails in an OpenAPI file

* Use static.gitbook.com for assets prefix
2024-03-06 18:09:34 +01:00
Samy Pessé 77527f0a4e Fallback for Intl.RelativeTimeFormat for old browsers (#219) 2024-03-06 17:08:09 +01:00
Steven H 9436549510 Fix an issue where ordered list items were not respecting the start property from the API. (#218) 2024-03-06 14:51:19 +00:00
Taran Vohra 76d6a2009e Fix visitor auth token lookup from request cookies (#215)
* Fix visitor auth token lookup from request cookies

* review
2024-03-06 15:34:25 +05:30
Samy Pessé 46c3ec6699 Add fallback to the different fonts (#216) 2024-03-06 10:59:43 +01:00
Samy Pessé 203e9103de Fix crash when displaying invalid Swagger 2.0 block (#214)
* Ignore errors when converting Swagger 2 to OpenAPI 3

* Apply page-api-block only when a block is actually displayed

* Format

* Try to be more lax
2024-03-06 10:43:11 +01:00
Samy Pessé d22944419f Prevent crash when integration associated to a block is no longer installed (#213)
* Prevent crash when integration is not installed for a block

* Format
2024-03-05 20:24:51 +01:00
Samy Pessé a9f9f18e66 Fix crash when resolving references without permissions (#212) 2024-03-05 19:45:38 +01:00
Samy Pessé fdaf722ba1 Align table cells to the middle (#211) 2024-03-05 18:17:32 +01:00
Samy Pessé 6c64841325 Use hardlinks instead of Next link for collection dropdown (#210) 2024-03-05 18:01:59 +01:00
Samy Pessé 44f4afdf94 Improve content reference resolution to support absolute ones to spaces (#209) 2024-03-05 17:39:24 +01:00
Samy Pessé a22bb55715 Do not crash on invalid LaTeX formulas (#208) 2024-03-05 16:16:29 +01:00
Samy Pessé 44945f887a Fix crash when no example can be generated for response of API (#207) 2024-03-05 15:51:40 +01:00
Samy Pessé cf20c5ff3b Output cache-control only when env is set (#206) 2024-03-05 15:46:08 +01:00
Samy Pessé c8935c62c8 Fix code block highlighting crashing when containing \r (#205) 2024-03-05 11:15:58 +01:00
Samy Pessé 1e1d202b5a Improve PDF export for tabs/expandables/api blocks (#204)
* Fix integrations blocks and text being too long

* Fix size of code blocks

* Open expandable by default on print mode

* Render tabs one after the other

* Adjust colors

* Open all in openapi when printing

* Fix title

* Format

* Fix TS
2024-02-29 19:49:03 +01:00
Samy Pessé d304c853fb Fix header logo (#203) 2024-02-29 14:46:56 +01:00
Samy Pessé 7278d7868d Translates and typing as safe-guard (#198)
* Translates and typing as safe-guard

* Add tests for intl
2024-02-29 12:09:53 +01:00
Samy Pessé cb91fb9df8 Fix access to cookies when used in iframe (#202)
* Fix access to cookies when used in iframe

* Allow https: embed
2024-02-29 11:24:55 +01:00
Samy Pessé 826ddbc533 Improve preview URL by better storing the api endpoint and the token in cookies (#201)
* Use one cookie per content and store api host in it

* Fix fallback to api endpoint

* Ignore parsing error
2024-02-29 10:46:41 +01:00
Samy Pessé 10375bae51 Add tracing to cache operations to debug I/O issue (#200)
* Change global context used to "cf"

* Add traces to cache operations
2024-02-29 10:19:57 +01:00
Samy Pessé f26e856170 Accept customization settings as a query paremeter (#199)
* Accept a query parameter "customization" to extend space customization

* Test it

* Use rison instead of JSON

* Use object version
2024-02-28 19:24:48 +01:00
Samy Pessé 2df5d68eae Pass next.internal on fetch requests to avoid I/O sharing (#197) 2024-02-28 15:26:36 +01:00
Samy Pessé 70c6c9df42 First pass at implementing ContentKit (#69)
* Start

* Try webframe

* Lint and format

* Move to package

* Continue

* Implement card and cleanup contexts

* Start code blocks

* Start rendering image

* Continue with card

* Start stack

* Start text

* Start modal

* Format

* Continue

* Fix TS errors

* Cleanup

* Make markdown work with server components

* Format

* Add visual test

* Lint and format

* Fix lifecycle

* Implement textinput

* Divider

* Remove console logs

* Remove listSpaceIntegrationsBlocks
2024-02-28 14:46:47 +01:00
Samy Pessé 8eb2850bdd Fallback crypto.randomUUID for old browsers (#196)
* Fallback crypto.randomUUID for old browsers

* Oups
2024-02-28 14:09:31 +01:00
Samy Pessé 887e99c8ed Archive build output on GitHub Actions 2024-02-28 10:52:41 +01:00
Samy Pessé 46b3e461dd Fix code block highlighting resulting in shared promises (#195)
* Fix code block highlighting resulting in shared promises

* Lint

* Fix tests
2024-02-28 10:44:47 +01:00
Samy Pessé 76ba5d043e Use customization.title instead of space.title (#194)
* Use customization.title instead of space.title

* Format

* Fix TS
2024-02-28 10:26:04 +01:00
Samy Pessé 5e12c0a9be Ignore errors when tracking page views (#193) 2024-02-27 16:27:09 +01:00
Samy Pessé 7ed89fe0fe Ignore errors with animate calls (#192) 2024-02-27 11:48:40 +01:00
Samy Pessé a3af78031f Use .ctx to avoid issue with proxy object (#191) 2024-02-27 11:15:58 +01:00
Samy Pessé 05de8109bb Fix crash for some code blocks with annotations (#190)
* Start

* Add failing test

* Better handle nested tokens

* Run tests in CI

* Comment

* Fix another case
2024-02-27 11:03:51 +01:00
Samy Pessé 41278bad68 Fix responsiveness of API blocks (#189)
* Add unit test

* Fix responsiveness of API blocks with 2 columns
2024-02-24 17:14:06 +01:00
Samy Pessé 884f5aabb0 Fix text overflowing on long words (#188)
* Break words when overflowing

* Format and add tests
2024-02-24 17:00:11 +01:00
Samy Pessé eea1323c17 Don't show aside when there is only one aside (#187) 2024-02-24 15:17:53 +01:00
Samy Pessé 341264e879 Fix page not found and main layout (#186)
* Switch to a global layout

* Format and improve main layout

* Fix TS

* Real fix

* Cleanup
2024-02-23 22:53:02 +01:00
Taran Vohra 345a2ea964 log request cookies in the middleware (#184) 2024-02-23 19:44:50 +05:30
Samy Pessé 56143277b7 Expose window.GitBook to integrations (#185)
* Expose window.GitBook to integrations

* Simplify

* Oups

* Use basic script to load integrations

* Preload the scripts
2024-02-23 13:32:09 +01:00
Samy Pessé aeeb9b0305 Hide table header when column titles are empty (#182)
* Hide table header when column titles are empty

* Add test

* Skip downloading puppeteer for some CI jobs
2024-02-22 13:23:56 +01:00
Taran Vohra 64bb5ebf5a Redirect after normalizing URL for VA (#183)
* Redirect after normalizing URL for VA

* Redirect after normalizing URL for VA
2024-02-22 17:31:41 +05:30
Taran Vohra 98d44f01c7 Do a redirect if visitor auth token found in param (#181)
* redirect if visitor auth token in param

* add resolved cookies to redirect
2024-02-22 16:41:43 +05:30
Samy Pessé 1fc9f17f76 Use correct colors for contrast header theme (#179) 2024-02-21 00:22:07 +01:00
Samy Pessé 9a25c8c19c Fix size of cards in table (#178) 2024-02-20 19:01:41 +01:00
Samy Pessé 09de40002a Fix share links resulting in errors because of (#177) 2024-02-20 14:29:14 +01:00
Samy Pessé a2d967e98e Use Joypixels instead of native emojis (#176)
* fist test

* Use a font

* Cleanup

* Use right fallbacks for fonts

* Lint

* Cleanup and comment

* Add visual test
2024-02-20 13:54:57 +01:00
Taran Vohra 258ef413b1 Fix logic to fetch visitor auth token from cookies and cleanup URL params (#175)
* Remove va token from query params before using it for response

* sanitize
2024-02-20 17:11:23 +05:30
Samy Pessé cf1f281119 Fix color of the title in the header when theme is custom (#174) 2024-02-20 09:14:04 +01:00
Samy Pessé 773fa50d41 Fix H# in aside and link to expandables (#173)
* Set ID on expandables

* Do not include h3

* Add a hash link

* Format

* Add tests
2024-02-19 20:00:18 +01:00
Samy Pessé b0725eb852 Fix CI deployment config 2024-02-19 16:36:06 +01:00
Samy Pessé 6bd6ddd031 Use an assetPrefix to serve all assets from same URLs (#172)
* Test an assetPrefix

* Fix condition

* Use the env instead

* Use it for CSP
2024-02-19 16:32:33 +01:00
Samy Pessé 9b285625d9 Hide page footer navigation when disabled in customization (#171) 2024-02-19 15:24:43 +01:00
Taran Vohra 8c0970d3d9 Ensure unique and isolated visitor auth cookie state (#169)
* Ensure unique and isolated visitor auth cookie state

* Fix typecheck

* Fix typecheck
2024-02-19 18:18:02 +05:30
Samy Pessé 1ad9bfd6f3 Fix image size in some cases (#170) 2024-02-18 21:28:11 +01:00
Samy Pessé 1a37b17a68 Implement color mark (#168)
* Define text and background colors

* Handle dark mode

* Add content tests
2024-02-18 00:21:50 +01:00
Samy Pessé c5455d4498 Display page emoji in content-ref blocks (#167) 2024-02-17 21:23:22 +01:00
Samy Pessé a82c548f42 Fix image size and alignment (#166)
* Fix image alignment

* Fix size of inline image

* Correctly size images
2024-02-16 18:58:59 +01:00
Sebastian Graz eead1dba66 add heading hash order conditional (#165)
* add heading hash order conditional

* v1 api color pass

* Delete .env

* Format

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-02-16 10:29:18 +01:00
Samy Pessé a7d4896484 Process all pages to fetch the list of spaces in a collection (#164) 2024-02-15 17:32:20 +01:00
Samy Pessé fa734fb217 Fix border radius for tabs and code-blocks when using straight corners (#163)
* Fix border radius for tabs and code-blocks when using straight corners

* Format
2024-02-15 15:37:18 +01:00
Samy Pessé 46a1b58d01 Fix responsiveness of footer (#162) 2024-02-15 12:54:29 +01:00
Sebastian Graz 12520ccede Style sprint 4 (#160)
* Commit

* make light base lighter, improve table legiblity

* improve hover leg on toc

* improve tabs leg

* improve tab design

* improve expandable leg

* slight global color tweak

* hide debugger
2024-02-15 11:50:04 +01:00
Samy Pessé ebdec4966b Use absolute URLs for logos (#161) 2024-02-15 10:06:05 +01:00
Samy Pessé 0b620640fa Fix hiding the table of content when disabled in page options (#159)
* Hide TOC when page is configured to hide it

* Improve layout in different cases
2024-02-14 17:19:07 +01:00
Samy Pessé 06fb56edc7 Fix emoji not displayed in cards with target (#157)
* Fix emoji not displayed in cards with target

* Only have hover effect on card when clickable

* Use 4 instead of 2
2024-02-14 15:42:20 +01:00
Samy Pessé 49a1561801 Update @cloudflare/next-on-pages to 1.9.0 (#156) 2024-02-14 12:35:39 +01:00
Samy Pessé b2acfab7c0 Enable zoom on drawings (#155) 2024-02-14 12:00:46 +01:00
Samy Pessé cf193f1738 Fix size of logo in header (#154)
* Fix sizing of logo in header

* Format

* Fix cases where size is not passed
2024-02-14 11:17:29 +01:00
Samy Pessé 6edd2648a4 Fiz zoom causing inline image to be displayed as block, also fix dark mode (#152)
* Fix inline image being displayed as blocks

* Make it work on dark mode

* Format
2024-02-13 22:12:28 +01:00
Samy Pessé ec1769fc32 Let users zoom images (inline and block) (#151) 2024-02-13 21:54:48 +01:00
Samy Pessé e9432c9486 Fix default size for inline images (#150)
* Fix default size for inline images

* Lint
2024-02-13 21:08:11 +01:00
Sebastian Graz c3d9e85823 Style sprint 3 (#136)
* first pass at nested ordered list symbols

* remove margin inside lists

* V1 of nested bullets & fix header hash pos

* clean up

* convert listItem render to switch

* Improve lists

* improve heading hash

* fix list todos to match heading size too

* no need for inline-grid

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-02-13 21:03:57 +01:00
Samy Pessé 3e2327c707 Change refiner feedback form URL 2024-02-13 19:01:41 +01:00
Samy Pessé f2e5ad97ab Show button to share feedback about GitBook Open when in preview mode (#149)
* Show button to share feedback

* Lint
2024-02-13 18:27:48 +01:00
Samy Pessé 45dd16b146 Improve caching: reduce browser caching, optimize perfs of worker cache (#148)
* Disable browser caching

* Improve cache read

* Fix

* Try using it for lookup

* Read before increment in redis

* Don't use multi

* Limit cache to 2min in cloudflare

* Cache in cloudflare but not in the browser
2024-02-13 16:09:38 +01:00
Samy Pessé 9e5f717fbe Fix Bearer schema in code sample (#147) 2024-02-13 11:01:33 +01:00
Samy Pessé be46c5db4b Fix error "Cannot perform I/O on behalf of a different request" (#146)
* Use reliable cloudflare context

* Format

* Comment
2024-02-13 10:06:58 +01:00
Samy Pessé 97dafa5580 Make match background a customization option (#134)
* Add classname

* Start applying it

* reset existing style changes in favor of global setup

* setup v1 plain mode

* fix name clash

* move light/dark bases as vars

* side image render fix

* customize individual light tiers for light mode

* Add comment about primary and base

* remove style prop from image

* w-unset not needed on image

---------

Co-authored-by: sebastiangraz <graz@live.se>
2024-02-12 21:03:49 +01:00
Samy Pessé f62656ed9f Persist token in multi-id mode in a cookie (#144)
* Persist token in multi-id mode in a cookie

* Format
2024-02-12 16:53:04 +01:00
Samy Pessé 46a3543a5e Use new version of cloudflare/next-on-pages and remove patch (#145)
* Use new version of cloudflare/next-on-pages and remove patch

* TS

* Fix ts again

* Remove patch-package

* Remove test

* Make it work locally
2024-02-12 16:38:33 +01:00
Samy Pessé 2470a40531 Only catch GitBookAPIError in getPublishedContentByUrl (#143) 2024-02-09 21:40:10 +01:00
Samy Pessé 34e339b5e4 Correctly handle errors from getPublishedContentByUrl (#142)
* Correctly handle errors from getPublishedContentByUrl

* Format

* Improve error message
2024-02-09 19:24:36 +01:00
Samy Pessé dfb8d4e8d4 Normalize the URL by redirecting (#141) 2024-02-09 12:59:33 +01:00
Samy Pessé 4826c9e012 Fix search button in compact mode (#140) 2024-02-09 11:56:57 +01:00
Samy Pessé 6441f8a05e Improve placeholder in search button and input (#139)
* Improve search placeholders

* Improve perfs of AI search

* Increase back font-size

* Format
2024-02-09 11:25:03 +01:00
Samy Pessé 6cab31faf6 Stream AI answers to questions (#138)
* Stream AI answers to questions

* Use a different polyfill

* Revert "Use a different polyfill"

This reverts commit b8474c56301faf3180eebf81f697703c31447500.

* Update api

* Patch event-source-polyfill to support Cloudflare

* Patch the min version

* Update api client and remove eventsource polyfill

* Cleanup
2024-02-08 15:53:05 +01:00
Samy Pessé 1c0ea074b3 Update API client and fetch API blocks in new format only (#137) 2024-02-07 18:19:30 +01:00
Sebastian Graz caa74cf48f Style sprint 2 (#135)
* fix tab multiline

* OpenAPI improvements (#127)

* Fix display of authentication infos

* Fix property names

* Fix body / request starting with oneOf

* CSS fixes

* Show description

* Format

* Fix code samples

* Convert swagger 2.0 to OpenAPI v3 (#128)

* Convert swagger 2.0 to OpenAPI 3

* Format

* Fix page with one api block shown as empty (#129)

* Fix page with one api block shown as empty

* Format

* Style sprint (#126)

* V1 code blocks fix

* equalize modal text label + fix safari bug with fixed position stroke

* code block adjustments

* fix search result spacing

* remove metal + adjust light and dark mode

* remove metal from tw config

* Add colordebugger + remove unused global colors

* correct opacities on all colors

* first part of cleaning up colors

* fix tab colors

* search modal color changes

* adjust global colors

* expandable + code color changes

* add delay to loading panes

* adjust globals

* improve select table type

* improve light mode checkbox

* fix delay

* content

* uncomment debug

* expandable fixes

* OpenAPI improvements (#127)

* Fix display of authentication infos

* Fix property names

* Fix body / request starting with oneOf

* CSS fixes

* Show description

* Format

* Fix code samples

* Fix empty API responses not being displayed (#130)

* Fix response not being displayed when contains no body

* Fix padding

* Resolve any JSON/YAML OpenAPI file and resolve common parameters (#132)

* Fix parsing of OpenAPI when content-type is unknown

* Resolve common parameters

* Format

* Add support for straight corners (#131)

* Add class to body and tailwind variant

* Use it on the search button

* Use it for buttons and cookies banner

* Use it for cards

* Use it in more places

* Lint

* More

* page feedback

* theme toggler

* Rename Authentication to Authorization (#133)

* remove unused color light-5

* fix dupe css

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-02-06 16:25:02 +01:00
Samy Pessé c829555f1b Rename Authentication to Authorization (#133) 2024-02-02 10:20:30 +01:00
Samy Pessé 53299ce829 Add support for straight corners (#131)
* Add class to body and tailwind variant

* Use it on the search button

* Use it for buttons and cookies banner

* Use it for cards

* Use it in more places

* Lint

* More

* page feedback

* theme toggler
2024-02-02 10:16:15 +01:00
Samy Pessé 260305759d Resolve any JSON/YAML OpenAPI file and resolve common parameters (#132)
* Fix parsing of OpenAPI when content-type is unknown

* Resolve common parameters

* Format
2024-02-01 22:29:28 +01:00
Samy Pessé b5e6673976 Fix empty API responses not being displayed (#130)
* Fix response not being displayed when contains no body

* Fix padding
2024-02-01 10:30:03 +01:00
Sebastian Graz e5fc5c2d2a Style sprint (#126)
* V1 code blocks fix

* equalize modal text label + fix safari bug with fixed position stroke

* code block adjustments

* fix search result spacing
2024-01-31 23:20:09 +01:00
Samy Pessé a8379be4c1 Fix page with one api block shown as empty (#129)
* Fix page with one api block shown as empty

* Format
2024-01-31 16:11:08 +01:00
Samy Pessé 75876474a2 Convert swagger 2.0 to OpenAPI v3 (#128)
* Convert swagger 2.0 to OpenAPI 3

* Format
2024-01-31 15:46:42 +01:00
Samy Pessé f8fde8cec8 OpenAPI improvements (#127)
* Fix display of authentication infos

* Fix property names

* Fix body / request starting with oneOf

* CSS fixes

* Show description

* Format

* Fix code samples
2024-01-31 14:36:20 +01:00
Samy Pessé 4bbd86aeca Render drawing blocks (#125)
* Improve rendering of block with captions

* Remove redirect test
2024-01-30 18:30:27 +01:00
Samy Pessé aeab122d54 Use flex and simplify code block styling to fix safari issues (#124) 2024-01-30 12:10:34 +01:00
Samy Pessé 85ec1884e6 OpenAPI blocks (#74)
* Start methods to resolve refs

* bun

* Start package

* Add code to resolve ref

* Continue

* Deref

* Start monorepo

* Continue

* Fix ref resolver

* Style a bit more

* Start toggling section

* Continue

* Start displaying query/path/headers params

* Hide respo se if empty

* Fix recursive refs

* Simplify interactive and styling

* Display enums

* Format

* Improve type name being displayed

* Improve naming

* Render oneOf/anyOf/allOf

* Handle circular references

* Start variable in server url

* Use client component for the spec part

* Improve CSS sizing

* Display open api blocks in aside

* Make aside an overlay

* Improve stickiness of openapi

* Align document on the left when api page

* Improve general layout

* Better align

* Fix padding in aside

* Use syntax highlighting

* Show sample of response

* Improve code generation

* Improve code generated

* Format

* Format

* Rename to OpenAPI

* Skip deprecated properties and handle additionalProperties

* Use discriminator for naming

* Better name enum

* Make entire header toggeable

* Format and lint

* Add curl example

* Improve curl

* style pass

* Start securities

* Bun

* Fix TS

* Improve label

* Start markdown

* Improve code samples

* Test

* Use custom skeleton for api block

* Format

* Add support for redocly code samples

* Fix api blocks in aside

* Use typography for markdown

* Format

* Fix spacing in markdown

* Render headers

* Format

* Format

---------

Co-authored-by: Sebastian Graz <graz@live.se>
2024-01-30 10:15:58 +01:00
Samy Pessé 86a436645a Increase font-weight of code mark in headings (#123) 2024-01-27 22:11:27 +01:00
Samy Pessé 0096947c72 Fix font-size and line-height of code text mark (#122) 2024-01-26 12:42:31 +01:00
Samy Pessé ee35796576 Lower traces sample rate on Sentry to 1% (#121) 2024-01-26 11:32:24 +01:00
Samy Pessé 7045675eda Fix soft-break in the document (#120) 2024-01-26 11:08:39 +01:00
Samy Pessé 730b444403 Improve cache invalidation (#119)
* Limit revalidation and limit memory cache to 5 min

* Format

* Return keys for memory cache invalidation
2024-01-25 15:44:28 +01:00
Sebastian Graz d4e3c6d597 v1 (#117) 2024-01-24 17:52:12 +01:00
Samy Pessé f1f91a6816 Fix opening search results (#118)
* Switch to nuqs

* Navigate post url update

* Fix

* Fix AI search
2024-01-24 17:25:01 +01:00
Samy Pessé b5986e833a Fix optimized image size when using inline image (#116) 2024-01-24 14:02:16 +01:00
Samy Pessé eabc46b86e Start using next-themes (#115)
* Start using next-themes

* Fix with nonce

* Lint
2024-01-24 11:39:59 +01:00
Samy Pessé aec74d68fd Stop using shared promises (#114)
* Try cf.cacheTags

* Remove shared promises

* Use a pendings set per context
2024-01-23 23:19:23 +01:00
Sebastian Graz 22a68a71c4 Style PR (#101)
* fix card clickthrough

* better checkbox empty states

* add card bg

* fix keynav styles search

* add v1 style for search scope

* scope mobile defensive css

* Update src/components/Search/SearchResults.tsx

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-01-23 21:40:03 +01:00
Samy Pessé 9d9040f24e Fix error for redirects/files on change-requests (#113) 2024-01-23 21:38:28 +01:00
Samy Pessé 613d67c14e Limit Cloudflare data cache to 5 minutes (#112) 2024-01-23 18:28:20 +01:00
Samy Pessé 5f7b29bbc8 Improve purging of cache and return keys (#111)
* Use input url instead of request url

* Improve cache purging

* Lint

* Fix TS

* Add method to delete from cloudflare

* Clear on all backends

* Fix

* Add global cloudflare tag
2024-01-23 18:21:46 +01:00
Samy Pessé 756b5a766f Setup Sentry for errors (#110)
* First try

* Lint and format

* Use edge runtime

* Use envs for sentry

* Fix type

* Fix upload of sourcemaps

* Try fixing monitoring calls

* Fix gitbook/monitoring in middleware

* test error in middleware

* Define context on sentry data

* Set SENTRY_ENVIRONMENT to preview or production

* Format

* Pass url and userAgent

* Remove test cases

* Disable debug

* Remove ignoreBuildErrors
2024-01-23 14:36:56 +01:00
Samy Pessé 29f2177357 Close table of content when clicking on a link (#109)
* Close table of content when clicking on a link

* Lint
2024-01-23 10:48:25 +01:00
Samy Pessé 0e4ba13065 Show page emoji if any (#108)
* Show page emoji if any

* Format
2024-01-20 23:41:28 +01:00
Samy Pessé 05f206a7a5 Use an input for the search input to scroll value when long (#106) 2024-01-20 21:46:58 +01:00
Samy Pessé e660432227 Add support for table text column alignment (#107)
* Align text in table based on set alignment

* Format
2024-01-20 21:46:35 +01:00
Samy Pessé 56b8b86f58 Correctly align logo to the left (#105) 2024-01-20 18:37:21 +01:00
Samy Pessé da215347f4 Add aria-busy to loading components (#95) 2024-01-20 18:34:52 +01:00
Samy Pessé ec075af455 Store the build version in the generator meta tag (#104)
* Store the build version in the generator meta tag

* Format

* Send header with version

* Add header on 404 as well
2024-01-20 12:43:59 +01:00
Samy Pessé 1f7530aaf8 Set a user-agent for the API (#103)
* Pass user-agent and allow configuring it with envs

* Format
2024-01-19 14:55:04 +01:00
Samy Pessé 8c44653292 Add back last modified date in the footer of the page (#102) 2024-01-18 23:13:49 +01:00
Samy Pessé a6f7a71af9 Fix right click to save images (#100) 2024-01-17 12:19:33 +01:00
Samy Pessé b16636c180 Only show table progress on browsers that supports it (#99) 2024-01-17 12:18:31 +01:00
Samy Pessé 64a9e27ca7 Resolve revision and change request URL correctly (#98)
* Add tests for getURLLookupAlternatives

* Match correctly revisions and changes URLs

* Use revision and changerequets ID passed from lookup

* Prevent indexing these urls

* Start

* Start rendering toolbar

* Update api client

* Format

* Format

* Mock resolve of snippet

* Add test for revision
2024-01-15 09:42:38 +01:00
Samy Pessé 3c44eb4f80 Fix resolving redirect by encoding path (#97) 2024-01-12 21:37:14 +01:00
Samy Pessé 6e5208d3ae Fix handling of special chars in the URL (#96)
* Fix handling of special chars in the URL

* Add log

* More logs

* Test encoding

* Cleanup
2024-01-12 21:18:23 +01:00
Samy Pessé 3c2dbb7b10 Fix crash on invalid selectors (#94) 2024-01-12 17:45:27 +01:00
Samy Pessé 59a8e74e39 Remove useless console.log (#93) 2024-01-12 16:55:09 +01:00
Samy Pessé 2a1e491fee Show loading indicator when loading first results in search (#92)
* Show loading indicator when loading first results in search

* Fornat

* Format
2024-01-12 15:40:46 +01:00
Samy Pessé 7d60c75dd8 Allow seo indexation of x-gitbook-search-indexation (#91) 2024-01-11 18:33:46 +01:00
Samy Pessé f4ac246a09 Redirect to original image when cloudflare resize is returning an error (#90) 2024-01-09 14:05:32 +01:00
Samy Pessé e7c184cc99 Search across all spaces in a collection (#89)
* Start buttons

* Run the search globally

* Improve look and feel

* Improve text

* Format

* Fix TS
2024-01-08 19:23:12 +01:00
Samy Pessé 28be5aaeca Fix resolution of URL for collection URLs (#88) 2024-01-07 23:19:05 +01:00
Samy Pessé 5f6ca7af56 Hide trademark when disable in customization settings (#87)
* Hide trademark when disabled in customization

* Fix padding in toc

* Run upload of artifacts when failed
2024-01-07 13:55:01 +01:00
Samy Pessé 46a726f3a8 Fix visual tests being unreliable (#86)
* Test

* Upload failed tests as artifacts

* Format
2024-01-06 19:11:30 +01:00
Samy Pessé a1fca33947 Switch to <a> instead of next Link for aside (#85) 2024-01-05 17:51:10 +01:00
Sebastian Graz ccfcaa590b Style PR (#84)
* fixes for table values

* color tweaks rating

* inc legibility on aside active

* add tab separators

* fix hint icon

* fix header colors & remove custom balance

* Better mobile burger colors

* remove border from logofallback img

* style divider dark mode

* compact header + file + expandable hover + mt mobile nav

* testing file types
2024-01-04 18:43:37 +01:00
Samy Pessé 87e67866a4 Fix condition to render document being reversed (#83)
* Fix condition to render document

* Format
2024-01-02 18:31:15 +01:00
Samy Pessé 0c80f96579 Show grid of sub-pages when page is empty (#82)
* Add a blankslate when the page has no document

* Format
2024-01-02 17:55:43 +01:00
Samy Pessé 22eeaca92c Add support for all column types (#81)
* Support files and content ref

* Display all column types

* Pass width

* Format
2024-01-02 10:43:52 +01:00
Sebastian Graz 66ba1c244f Styling PR (#80)
* add BR to TOC links

* fix sticky TOC padding

* increase searchbar contrast

* align toc and aside

* copy on hover only

* nicer tabs

* more dynamic table sizes

* dynamic expandable treatment

* skeleton v1

* modal spacing + close modal on source click

* fix page link icon TOC

* add PDF separate spacing

* fix TW Intellisense + further styling of loadingpane

* properly style skeletons

* better loading panels, AI search enhancement while waiting

* Commit

* Use the same state for answer

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2024-01-02 09:09:01 +01:00
Samy Pessé 0668d8a287 Track page view (#42)
* Track page view using a server action

* Track the page view

* Format

* Track it once

* Support no page an pass language

* Update API client
2023-12-29 15:28:49 +01:00
Samy Pessé 2fdf3e3838 Progressive loading (#79)
* Suspense boundary and progressive loading on blocks

* Start refactoring to better leverage app router

* Use skeleton for page layout

* Improve dynamic toc

* Switch page full width to be client side only

* Format

* Remove old PageLoading

* Fix first page not marked as active

* Close search when clicking search link
2023-12-28 14:38:15 +01:00
Samy Pessé 1c2d68c518 Fix handle of multi-id and improve PDF UI in that case (#78)
* Fix handling urls with direct space ID

* Preserve all search params when navigating in the PDF UI

* Show a trademark on the pdf page

* Generate proper trademark url

* Format

* Cleanup
2023-12-27 16:32:59 +01:00
Samy Pessé c8358feeeb Support an "api" query parameter in mode multi-id (#77) 2023-12-27 14:15:47 +01:00
Samy Pessé 6cf73e4962 Support URL path to directly access a space by its ID (even private) (#76)
* Handle URLs /~space/:id

* Validate permissions in multi-id mode
2023-12-27 13:46:35 +01:00
Samy Pessé 67b20138dd Show loading, fix z-index and prevent print from opening (#75) 2023-12-27 11:37:44 +01:00
Samy Pessé 83f4cb5968 Add link to PDF export in the page and improve PDF UI (#73)
* Add buttons to pdf page

* Present as page

* Fix break

* Show active page

* Add description

* Make buttons work

* Handle back link

* Show alert when reaching maximum

* Format
2023-12-26 23:14:46 +01:00
Samy Pessé 24f5e73bbe PDF export (#72)
* Start

* Improve generation

* Improve style

* Lint

* Use tilde instead of dot in the url

* Improve style

* Fix page group

* Format

* Add visual tests for PDF
2023-12-26 18:36:44 +01:00
Sebastian Graz 1fde857aee Stylepr (#60)
* hint leading

* first attempt at themed ui

* v2 theme ui

* fix feedback

* fix hint css override

* cookie

* more sensible scroll logic

* Add better heading margin

* inline code styling

* fix copy button, list vis, next/prev mobile

* add shortcut to search button

* search button, toc

* add toc style

* fix toc hover

* safari fix

* simplify search, swagger, next/prev

* add mask to page cover

* codeblock fix

* global defaults

* improve mobile cards

* modal changes

* change mask intensity dark mode, fix table progress zindex

* a target

* selection, footer, search icon

* fix card resp

* fix multi col images

* fix aside

* card item pos

* search vis

* reuse same header for mobile

* fix header and search legibility

* format

* Sidebar changes

* remove linear gradient light mode page cover
2023-12-26 14:38:54 +01:00
Samy Pessé 4d38479a0f Render inline images (#71)
* Implement inline images

* Format
2023-12-26 12:22:19 +01:00
Samy Pessé db4d4a3408 Format (#70) 2023-12-26 11:20:08 +01:00
Samy Pessé 7267398d5b Use caching for search/ask and rich content for answers (#68)
* Use caching for search/ask

* Refactor DocumentView to be ready to be used for other stuff

* Start logic to use document

* Fix comment

* Remove log

* Format and typecheck
2023-12-25 22:59:14 +01:00
Samy Pessé 2d4c9880fd Fix last accessibility issue in cookies modal and try CI to monitor regressions (#67)
* Add aria-label to cookies modal

* Test lighthouse

* Remove lighthouse as it doesn't work in bun

https://github.com/oven-sh/bun/issues/4958

* Translate everything in search
2023-12-24 17:44:36 +01:00
Samy Pessé 231654e43b Improve accessibility of the cookie banner (#66) 2023-12-24 16:30:34 +01:00
Samy Pessé bfdf6640c8 Add "Edit on GitHub" in aside (#58)
* Start showing link in the aside

* Show link in aside

* Add icon next to link

* Fix padding
2023-12-24 16:04:25 +01:00
Samy Pessé 528a06c65a Improve scroll and aside (#64)
* Scroll to the right location and show active section in aside

* Format
2023-12-24 16:02:34 +01:00
Samy Pessé f7cb622863 Render inline emojis as native emojis (#65) 2023-12-24 14:53:22 +01:00
Samy Pessé 6f6dde1aa4 Update tailwind to 3.4 (#63)
* Update tailwind to 3.4.0

* Update tailwind-merge

* Fix responsive for cards in the footer

* Make card responsive

* Lint
2023-12-24 01:26:51 +01:00
Samy Pessé 3188795a52 Improve not found error (#62)
* Implement error page

* Improve color

* Lint

* Add padding for mobile
2023-12-23 23:25:01 +01:00
Samy Pessé e681aa6ba1 Use card for embed and display caption (#61)
* Use card for embed and display caption

* Fix warnings in icon
2023-12-23 22:49:28 +01:00
Samy Pessé 215c724a9b Use Cloudflare Cache API as one of the cache backend (#59)
* Implement cache for cloudflare

* Start using it

* Fix cache use

* Generate proper URLs

* Comment

* Fix cache always resulting in cache miss

* Log

* Correctly cancel redis

* Write to fallback caches

* Disable memory cache

* Re-enable memory cache

* Try patching

* Use it

* Also patch package.json

* Fix TS errors

* Remove yarn.lock

* Fix local error

* Lint

* Try bunx to fix vercel build

* Update lockfile

* Add back revalidating
2023-12-22 11:05:14 +01:00
Sebastian Graz c1d3f990f1 Styling PR (#56)
* v1 loading state

* refactor primitives

* fix order

* fix toast styling

* v1 rating

* transition on page spinner

* visual fixes
2023-12-21 16:51:36 +01:00
Samy Pessé 6a62f42521 Lazy load KaTeX CSS (#57)
* First attempt at lazy loading it

* New approach

* Format

* Remove logs
2023-12-21 15:11:06 +01:00
Samy Pessé e81d65dc2e Fix typescript error 2023-12-21 12:38:09 +01:00
Sebastian Graz c5f75116d3 Commit (#45) 2023-12-21 12:27:12 +01:00
Samy Pessé c18ec51a4a Experiment with setting Cloudflare-CDN-Cache-Control to force caching 2023-12-21 10:24:11 +01:00
Samy Pessé 5f690af5fb Fix flash of the header when switching between light and dark mode (fix RND-1917) 2023-12-20 18:22:07 +01:00
Samy Pessé fbc2ae10a0 Show cookies approval toast (#55)
* Show cookies toast when privacy policy is enabled

* Flex buttons

* Improve design

* Fix mobile design
2023-12-20 16:51:14 +01:00
Samy Pessé ca3ab044c3 Improve CI with caching and lint work (#53)
* Cache next.js build

* Add format and lint job

* Run typecheck

* FIx all TS issues

* Declare modules for images
2023-12-20 16:07:18 +01:00
Samy Pessé 2888b95b36 Accept a GITBOOK_TOKEN to fetch published content (#54) 2023-12-20 16:04:44 +01:00
Samy Pessé b11566dfb1 Fix favicon for collections and improve middleware matching (#52)
* Use collection title instead of space/customization title when possible

* Skip useless match
2023-12-20 11:41:04 +01:00
Samy Pessé be198045b1 Fallback to using hash of arguments for cache key (#51)
* Fallback to using hash of arguments for cache key

* Dummy commit to trigger build
2023-12-20 09:36:20 +01:00
Samy Pessé 720c2ca909 Setup visual testing (#50)
* Add cloudflare job to publish pages

* Try like this

* Fix build path

* Try end to end

* Fix installation

* Use var instead of secret for CLOUDFLARE_PROJECT_NAME

* Use new puppeteer mode

* Add more tests

* Run in parallel

* Go back to no-concurrency

* Test pagespeed

* Print output

* Fix thresholds
2023-12-19 23:51:06 +01:00
Samy Pessé c935700672 Improve cache revalidation to avoid processing keys multiple times 2023-12-19 19:39:04 +01:00
Samy Pessé e04d03c696 Remove cache tags for documents 2023-12-19 19:31:14 +01:00
Samy Pessé 4f84011f6b Purge cache when option is passed and revalidate starting by entries with max hits (#49)
* Accept an option to purge without refreshing

* Store hits on the redis cache entry

* Revalidate first the entries with the most hits

* Format

* bun

* Ignore error from JSON.NUMINCRBY
2023-12-19 19:16:36 +01:00
Samy Pessé 93aa1cfabf Fix typecheck in .gitbook folders 2023-12-19 18:13:11 +01:00
Samy Pessé 522eaa4319 Fallback to API to resolve page by path to handle redirects (#48) 2023-12-19 15:55:00 +01:00
Samy Pessé 772d120e3a Show loading spinner when navigating between pages (#46) 2023-12-19 15:24:54 +01:00
Samy Pessé bfe91f71f9 Generate robots.txt and add meta link to privacy policy (#47) 2023-12-19 13:34:55 +01:00
Samy Pessé e903bb7752 Update upstash module to fix typing 2023-12-19 10:11:58 +01:00
Sebastian Graz 196e8bcfc0 quickfix: add overflow hidden if search modal open 2023-12-18 23:11:54 +01:00
Samy Pessé eb8baffcf8 Add class search-open to body when search modal is displayed 2023-12-18 22:03:07 +01:00
Sebastian Graz f3ecb69404 modal Y position 2023-12-18 21:53:35 +01:00
Sebastian Graz 86fe37f968 Search PR (#44)
* add search spinner

* better dark/light settings

* text color use textarea for input to get multiline

* fix fonts

* fix margins on result

* fix local ascent override, primary spinner color

* fix overflow

* fix overflow not scrolling all the way up

* testing hiding sidescroller on hover

* add better hover

* no-answer fix
2023-12-18 21:32:54 +01:00
Samy Pessé 953c6bd194 Revalidate cache instead of just invalidating it (#43)
* Store arguments and tags in redis cache

* Refactor cache to support revalidation

* Format

* Fix redis cache

* Try with both GT and NX

* Fix get from redis

* Fix json syntax

* New attempt

* Fix log

* Skip case where there is no key for tags

* New try

* Ignore when no tags is passed
2023-12-18 21:03:07 +01:00
Samy Pessé fc68dbdd4e Fix accessibility issues reported by PageSpeed tests (#41)
* Set aria-label on all buttons

* Use a <p> instead of <h4> in footer
2023-12-18 12:31:56 +01:00
Samy Pessé 705ea6c997 If image resizing fail, redirect to origin image 2023-12-18 12:07:49 +01:00
Samy Pessé 13b9f6b07f Optimize images using Cloudflare Images (#40)
* Optimize images using Cloudflare Images

* Try skipping middleware

* Make it work with base path

* Fetch image size

* Use a target instead of the cf fetch options

* Fix resizing

* Start optimizing images

* Preload images

* Use it for page cover

* Format and adapt cover

* Fix image resizing serving jpeg

* Lazy load dark mode images

* Timeout at 2s

* Fix iframe CSP

* Implement logic to lazy load images that should be offscreen

* Also lazy load cover images

* Low priority in preloading

* Fix csp
2023-12-17 22:26:07 +01:00
Samy Pessé afcb0ecba6 Load integration scripts and secure the app with CSP (#39)
* Set colorSchema metadata

* Try CSP

* Move colorScheme to generateViewport

* Bun install

* Use wildcard for img-src and connect-src

* Allow all unsafe-inline for now for style

* Remove nonce for style

* Remove nonce for style

* Optimize data fetching with parallel requests

* Try to reuse memory cache between middleware and rendering in CF

* Comment

* Fetch document in parallel of collections

* Cleanup

* Log if redis is enabled for caching

* Fix memory cache before redis one

* Optimize alternatives being tested
2023-12-17 00:25:07 +01:00
Samy Pessé 046e74b4a8 Page ratings form (#38)
* Start showing ratings in the aside

* Conditionally render it

* Format

* Lint

* Accept NEXT_PUBLIC_GITBOOK_APP_URL
2023-12-15 22:43:44 +01:00
Samy Pessé 4dfb7c1e61 Load all fonts (#37)
* Load all fonts

* Use font-content as CSS variable

* Fix weird performance.now issue

* Fix font definition
2023-12-15 12:16:52 +01:00
Samy Pessé 594a1d18a7 Log cache performances (#36)
* Log cache performances

* Handle concurrent requests

* Debug log

* Remove debug log

* Comment
2023-12-14 18:33:09 +01:00
Samy Pessé 909a6e76f5 AI Search: recommended questions and hide if disabled (#35)
* Don't show AI search if ask is disabled in the space

* Fetch recommended questions

* Comment and format

* Fix when withAsk is false

* Format

* Lint
2023-12-14 17:38:02 +01:00
Sebastian Graz 5103686d7f remove content-ref for now 2023-12-14 16:51:46 +01:00
Sebastian Graz dae7f704fa Style PR (#34)
* codeblock styling

* fix hover rounding

* checkpoint layout

* improve highlight algo

* v1 syntax theme

* fix table cell add title style

* color tweaks

* opaque sticky numbers

* fix collection spaces

* card aspect fix

* adding back full-width tables

* num tabs

* Add v1 more table types

* format
2023-12-14 16:17:13 +01:00
Samy Pessé 87c38f9091 Sources and followup questions in AI search (#33)
* Show followup questions

* Show sources

* Lint
2023-12-13 08:55:14 +01:00
Samy Pessé ece7f421b4 First basic integration of AI search (#32)
* Refctor Intl and show "Ask" in search

* Handle ask state in the url

* Start fetching answer
2023-12-13 00:57:42 +01:00
Samy Pessé 7a87cc1bb1 Implement an endpoint to clear cache for a space (#31)
* Implement a tagging logic for cache value

* Extract cache-tags from HTTP requests

* Auto-tag API cache entry

* Implement route

* Output cache-control and cache-tag

* Make the revalidate route a edge one
2023-12-12 23:34:18 +01:00
Samy Pessé 2001e4dba5 Use absolute URLs for metadata (icon / social graph) (#30)
* Use absolute URLs for metadata (icon / social graph)

* Disable cache using "next" instead of "cache"

* Use cloudflare module from upstash
2023-12-12 21:38:22 +01:00
Samy Pessé f13e6cb55b Fix use of abort controller and parallel lookup of url 2023-12-12 20:58:37 +01:00
Samy Pessé fff0ea8c34 Add logs 2023-12-12 19:28:34 +01:00
Samy Pessé ee0b3c2032 Wait for cache operation before responding in middleware 2023-12-12 19:24:22 +01:00
Samy Pessé a4ae7140f2 Remove GitHub actions staging workflow 2023-12-12 19:23:23 +01:00
Samy Pessé 7cdf04d2da Remove debug log and try with a single alternative url 2023-12-12 19:03:13 +01:00
Samy Pessé 9138b18a68 Add debug logs 2023-12-12 12:17:31 +01:00
Samy Pessé 632ac7bbab Test by passing a x-forwarded-host header 2023-12-12 11:03:08 +01:00
Samy Pessé ff8a343a54 Fix new cache on Cloudflare (#29)
* Try with next.revalidate = 0

* Remove log

* Format
2023-12-12 10:56:07 +01:00
Samy Pessé b7a4721d66 Fix expired token with fetch data cache (#28)
* Start using cache module for getPublishedContentByUrl

* USe cache-header in cacheResponse

* Pass no-store to getPublishedContentByUrl

* bun install
2023-12-12 10:10:54 +01:00
Sebastian Graz 9e0aabc8bd Styling PR 4 (#24)
* add space to expandable, reduce shadow

* temp animation

* little better anims

* v1 stagger

* add opacity-0 back

* fix opacity on header

* overlay fix opacity

* fix chevron shrink

* style summary arrow

* search button add transition

* style hint custom anchor colors

* Commit

* image border

* fix text color hints

* fix code & code within hints

* annotation pass

* clean up

* setup before iconwork

* simplify hint animations

* allow heading sizes in hints, fix global outline

* fix arrows pagefooter

* increase hitarea arrow

* style ol ul

* v1 checkbox

* toc motion speed

* link legibility, move header links to end, anchor underline

* table pass for busy content

* better table defaults

* v1 table side scroller

* only show on threshold

* format
2023-12-11 20:21:18 +01:00
Samy Pessé 860bc02aa8 Fix code highlighting in Cloudflare (#27)
* Try calling WebAssembly.instantiate directly

* Load from shikiji/onig.wasm instead
2023-12-11 13:43:30 +01:00
Samy Pessé e880bce80b Fallback to plain code block if syntax is not found (#26)
* Fallback to plain code block if syntax is not found

* Try with shikiji instead

* Fix css variables

* Try calling loadWasm

* Support highlighting for all languages of shikiji

* Remove shiki

* Install vscode-oniguruma

* Run bun
2023-12-11 13:23:21 +01:00
Samy Pessé eea8aa306e Prevent search indexation for now 2023-12-10 23:44:20 +01:00
Samy Pessé cf925fd21c Update next to 14.0.4 2023-12-10 23:07:41 +01:00
Samy Pessé 0d15b052ab Fix metadata for pages: title and og images 2023-12-10 22:19:36 +01:00
Sebastian Graz 5761b1914a Styling PR 3 (#23)
- Fix headings always showing hashtag
- replace slate-color with Gitbook brand everywhere
- add gitbook logo to TOC
- Style inline code blocks like `these`
- made TOC headings sticky to top on scroll
- Redesign the blockref component
- Nicer use of `ring` instead of `border` for layout separation
2023-12-05 20:44:56 +01:00
Sebastian Graz d38752433f Styling pr 2 (#20)
- hints remove blend mode on depth > 1
- hints icons animated
- Fix color theming on dropdown menu sub items
- figure out custom shadows for 1px stroke outside paragdim
- tab blocks add spacing between items
- set default accent/primary color if not set
2023-12-04 20:43:47 +01:00
Samy Pessé 8e5b28d2e0 Page cover (#22)
* Start rendering for the cover

* Style image

* Negative margins

* Support hero cover
2023-12-04 16:51:37 +01:00
Samy Pessé ba0d38c220 Page layout options (#21)
* Hide title/description based on layout

* Hide aside based on page.layout.outline

* Hide pagination based on layout

* Hide table of contents based on layout
2023-12-04 00:29:20 +01:00
Samy Pessé 5d236c138a Update gitbook/api@0.18.0 2023-12-03 19:17:25 +01:00
Sebastian Graz bc6244bb58 Styling PR 1 (#16)
* add maxwidth limit for very large screens

* testing animation on hints

* page aside style on darkmode

* fix icon TOC

* Make scrollbars stable when overflowing

* fix scrollbar on search

* search compact header

* search style

* test without bg toc

* Commit

* setup before mobile TOC

* test if style{} clashes

* fix TOC hover

* add prevent default on search shortcut

* add deps

* Add header mobile menu setup

* work on fallback logo

* style search modal position

* style hamburger button

* padding

* add rudimental toggle

* comment

* gap value responsive

* remove slate

* fix z index

* undo test

* Install and format

---------

Co-authored-by: Samy Pessé <samypesse@gmail.com>
2023-11-29 21:18:47 +01:00
Samy Pessé 0cdb5fdf61 Resole root page to / instead of its entire path (#19) 2023-11-29 19:20:31 +01:00
Samy Pessé 78f2469a53 Try the edge runtime (#18)
* Use edge runtime

* Install
2023-11-29 13:38:31 +01:00
Samy Pessé c0f7ccfe3f Dummy commit to trigger Vercel 2023-11-28 21:19:37 +01:00
Samy Pessé 28915e906f Fix invalid colors generated when deployed (#17)
* Try logging

* Try

* Try

* Fix?

* Format

* Remove log
2023-11-28 18:04:26 +01:00
Samy Pessé 92451dba91 Improve middleware with support for x-gitbook-basepath (#15)
* Accept a x-gitbook-api to use as the API endpoint

* Format

* Add support for x-gitbook-basepath

* Add skipTrailingSlashRedirect
2023-11-28 12:43:54 +01:00
Samy Pessé 02715436e7 Accept an X-GitBook-Api header to configure the API endpoint (#14)
* Accept a x-gitbook-api to use as the API endpoint

* Format
2023-11-27 19:00:31 +01:00
Samy Pessé b8af0cb4af Second try with staging git workflow 2023-11-27 16:06:29 +01:00
Samy Pessé b2b2a8c23c Automatically update the staging branch from main using a GH action 2023-11-27 16:03:30 +01:00
Samy Pessé 808f10d428 Namespace cache and prepare handling staging requests (#13)
* Implement UPSTASH_REDIS_NAMESPACE

* Accept X-GitBook-Host and switch to multi mode when present

* Format
2023-11-27 15:50:41 +01:00
Samy Pessé ee0d45fa8b Try fixing PageAside 2023-11-27 14:49:59 +01:00
Samy Pessé 315954dffc Use the new document API to fetch page document (#12)
* Use new API

* Remove getPageDocument

* Format
2023-11-27 13:57:10 +01:00
Samy Pessé bb8b039c1a Code blocks (#10)
* Remove added line

* Improve gutter and prepare wrap

* Style layout of code blocks

* Start rendering annotation

* Test serverComponentsExternalPackages

* Directly import theme

* Use Tailwind with shiki

* Prepare idea on how to lazy load languages

* Start better matching with inlines

* Make test work

* Start loading more languages

* Start annotations

* Format

* Fix multiple lines

* bun install
2023-11-26 23:49:04 +01:00
Samy Pessé fbd17713fe Use newer APIs to optimize data loading and fix resolution of links in the TOC (#11)
* Update api@0.16.0

* Fetch pages and files independantly

* Correctly resolve content ref in TOC

* Format

* Format

* Cleanup
2023-11-26 23:46:51 +01:00
Samy Pessé 2a03461a21 Improve readme 2023-11-23 11:31:04 +01:00
Samy Pessé 84fd934fe1 Try custom cache (#9)
* Try custom cache

* Fix redis cache

* Comment
2023-11-21 21:19:08 +01:00
Sebastian Graz aab7d0bd7a Design pass (#8)
* first stab at bullet points
* setup theming, custom opacities, use of brand UI colors
* color key change
* delete brand
* setup initial defaults
* Add opacity parameter to primary color
* style TOC
* styling pass header, footer, hints, toc, trademark
* table pass
* style pass, typo, quote, tabs, search, theme, toc
2023-11-21 18:29:36 +01:00
Samy Pessé a4ec3c8c53 Refactor routing logic for production to support multi-tenancy (#7)
* Move back to use the middleware as the main logic

* Fix link

* Improve lookup to support docs.gitbook.com.localhost:3000

* Make it work with dev url in prod for now

* Start lookup with API

* Continue

* Prepare for cloudflare build

* Dummy commit

* Try to abort requests

* Support x-forwarded-host

* Test multiple modes

* Add logs

* Add logs

* Update next

* Default to multi-path

* Switch back to nodejs runtime

* Adapt to staging API

* Make sure to return an absolute url for a redirect

* Update api client and try single request

* Try again with concurrent lookup
2023-11-21 16:53:02 +01:00
Samy Pessé 88795e35d9 Update @gitbook/api 0.14.0 (#6)
* Simplify types

* More fixes
2023-11-15 13:46:30 +01:00
Samy Pessé 2fe11a35d4 Functional foundation for search modal (#5)
* Start fetching search using a server actions

* Format

* Keyboard navigation in search

* Highlight query in results

* Add translation to input placeholder

* Add placeholder when no results
2023-11-14 21:36:53 +01:00
Samy Pessé 257f7cd62a Add demo (#4) 2023-11-14 18:11:32 +01:00
Samy Pessé 462b2b6e65 Add support for no header in customization settings (#3)
* Start hiding header

* Adapt page aside as well

* Revert condition
2023-11-13 22:08:29 +01:00
Samy Pessé 77f769c9c2 Fix some TS issues and group import during lint (#2)
* Start fixing TS errors

* Continue

* Also add dom.iterable

* Group header and lint
2023-11-12 21:17:18 +01:00
Samy Pessé df2e267fb2 Start search UI (#1)
* Start

* Improve style

* Add shortcut to open search modal
2023-11-12 00:46:30 +01:00
Samy Pessé 55b29ca608 Fix sitemap 2023-11-10 12:59:46 +01:00
Samy Pessé 61718847b0 Update typing for customization and use latest version of next.js 2023-11-09 19:10:20 +01:00
Samy Pessé 1d44267958 Fix icons 2023-11-04 23:40:17 +01:00
Samy Pessé f190139d5d Test fr 2023-11-04 23:37:55 +01:00
Samy Pessé cf54430651 Format 2023-11-04 23:35:45 +01:00
Samy Pessé d786e1332f Test emoji 2023-11-04 23:35:39 +01:00
Samy Pessé 9ed5dc490e Improve rendering of footer links 2023-11-04 23:30:17 +01:00
Samy Pessé 926fa0f52c Improve rendering of images 2023-11-04 23:24:18 +01:00
Samy Pessé 0eab4389a4 Make footer conditional 2023-11-04 19:02:01 +01:00
Samy Pessé a7c323a023 Start footer 2023-11-04 18:51:53 +01:00
Samy Pessé e5d94dbd23 Add support for emoji in icon 2023-11-04 18:32:05 +01:00
Samy Pessé 288e5db8dc Start favicon generation 2023-11-04 18:26:48 +01:00
Samy Pessé f84a5a2214 Improve accessibility of dropdowns 2023-11-04 16:06:59 +01:00
Samy Pessé 208dca6bab Start supporting collections 2023-11-04 15:18:30 +01:00
Samy Pessé f45735798a Start header links 2023-11-04 00:18:58 -04:00
Samy Pessé abb3ed132a Start theming header 2023-11-03 22:58:04 -04:00
Samy Pessé 13df0d69f4 Generate entire palette of shades for primary color 2023-11-03 22:29:20 -04:00
Samy Pessé cdddebb931 Start using dynamic color for primary 2023-11-03 22:14:29 -04:00
Samy Pessé 47cc664b4f Fetch customization settings 2023-11-03 21:36:40 -04:00
Samy Pessé df84dda36a Implement block content ref 2023-11-03 21:23:41 -04:00
Samy Pessé 84dd482430 Better type inline 2023-11-03 21:13:04 -04:00
Samy Pessé 1e389fca86 Use cache and fix crash in TOC 2023-11-03 21:03:38 -04:00
Samy Pessé 2d4faaf396 Add link to generate links in PDF mode 2023-11-03 16:59:37 -04:00
Samy Pessé 85af5fd4e2 Start PDF html generation 2023-11-03 16:16:00 -04:00
Samy Pessé 8a08f5ae94 Start generating sitemap.xml 2023-11-03 15:45:42 -04:00
Samy Pessé af646b05af Update @gitbook/api 2023-11-01 14:04:23 -04:00
Samy Pessé 07ad0d3909 Try more blocks 2023-11-01 13:41:14 -04:00
Samy Pessé 12da9e27bb Implement block file 2023-10-31 19:22:37 -04:00
Samy Pessé 2b56afb848 Fix some blocks 2023-10-31 18:46:47 -04:00
Samy Pessé 117721f5f6 Fix crash 2023-10-30 20:11:48 -04:00
Samy Pessé 9ab6bf0cec Render inline and block math 2023-10-30 19:50:09 -04:00
Samy Pessé 2e28affa93 Fix type 2023-10-30 19:03:15 -04:00
Samy Pessé 55464029d4 Add support for quote 2023-10-30 18:59:17 -04:00
Samy Pessé d9b8ae95bd Add icons and color to hint 2023-10-30 18:48:17 -04:00
Samy Pessé 80e4d7186c Better type and implement start of cards 2023-10-30 15:45:31 -04:00
Samy Pessé 62ddeaa6bf Start swagger 2023-10-30 13:05:57 -04:00
Samy Pessé 2d278e612c Disable typechecking in next build 2023-10-29 23:32:55 -04:00
Samy Pessé 4b46eac5ba Improve flex in header 2023-10-29 16:50:22 -04:00
Samy Pessé 73fcc0f9ae Use it for the page footer as well 2023-10-29 16:33:27 -04:00
Samy Pessé b5b7090bb9 Start translations 2023-10-29 16:29:59 -04:00
Samy Pessé af09b108d1 Add button for headings 2023-10-29 15:16:35 -04:00
Samy Pessé 66157393ea Start table 2023-10-29 13:49:31 -04:00
Samy Pessé e62f91dc0d Start dark mode 2023-10-29 10:11:33 -04:00
Samy Pessé cca37bc9e8 Start rendering images 2023-10-29 09:05:48 -04:00
Samy Pessé 873570543f Start expandable 2023-10-24 22:14:20 +02:00
Samy Pessé dd0e6db171 Start tabs 2023-10-24 22:07:19 +02:00
Samy Pessé 7295d25e4e Start aside with sections 2023-10-24 21:42:45 +02:00
Samy Pessé e1372b0ede Make layout great! 2023-10-24 20:57:00 +02:00
Samy Pessé 4ab6e6272e Improve layout and prepare for full width blocks 2023-10-24 20:07:27 +02:00
Samy Pessé cdf17b2d80 Improve search button and add line on toc 2023-10-24 19:32:18 +02:00
Samy Pessé e675454117 Add icons and improve toggeable buttons in the toc 2023-10-24 19:12:32 +02:00
Samy Pessé cde014a355 Start prev/next navigation 2023-10-24 18:48:37 +02:00
Samy Pessé cfb197067a Start search box 2023-10-24 18:22:40 +02:00
Samy Pessé 6786f64c9f Fix page link resolution 2023-10-24 17:45:13 +02:00
Samy Pessé 3443ed3e82 Start link and switch to tailwind-merge 2023-10-24 17:42:54 +02:00
Samy Pessé cef72dca61 Start marks and fix h3 2023-10-24 14:00:57 +02:00
Samy Pessé 3cb826de96 Start highlighting of code blocks 2023-10-24 13:36:32 +02:00
Samy Pessé 5f01b90f55 Open ancestors of current page in TOC 2023-10-24 08:25:06 +02:00
Samy Pessé b41ab9115d Start toggling toc 2023-10-24 08:12:43 +02:00
Samy Pessé 970731b38a Improve cover image 2023-10-24 07:52:29 +02:00
Samy Pessé 02bbb39765 Simplify and generate og:image for each page 2023-10-23 21:32:29 +02:00
Samy Pessé e29fb2091e Start generating metadata for the page 2023-10-23 00:05:13 +02:00
Samy Pessé 68d198f255 Start search button 2023-10-22 23:57:36 +02:00
Samy Pessé 0b6910951d Start 2023-10-22 23:48:31 +02:00
Samy Pessé 0e90584911 Initial commit from Create Next App 2023-10-22 15:24:44 +02:00
1024 changed files with 137492 additions and 15883 deletions
+8
View File
@@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
+11
View File
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
+3
View File
@@ -0,0 +1,3 @@
# Changes to the API data cache functions can invalidate all existing data cache
# causing a massive amount of revalidation, impacting our API.
packages/gitbook/src/lib/data/api.ts @SamyPesse
+111
View File
@@ -0,0 +1,111 @@
# Welcome to GitBook's contributing guide!
> _For help, support, feature requests, and product questions - head to our [GitHub Community](https://github.com/orgs/GitbookIO/discussions) 🤖_
Thank you for investing your time in contributing to GitBook. Any contribution you make will be reviewed by our team. In this guide, you'll learn the different ways you can contribute.
## Types of Contributions
This repository contains code related to the rendering engine of GitBook's published content. Depending on what you'd like to contribute to, head to the section below to find the necessary steps.
### Add a feature
Because this portion of GitBook is open source and available for you to use - if you think you can provide extra value through a new feature - you're welcome to add it! If you plan to distribute the code, keep the source code public to comply with GNU GPLv3. To clone in a private repository, you must first acquire a [commercial license](https://www.gitbook.com/pricing).
### Create a new issue
If you spot a problem within a repository, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue here!Please make sure any added issues are
- Descriptive
- Thoughtful
- Organized
We recommend adding as many relevant links, minimal reproductions of the issue, and other materials that will help our team solve the issue fast.
### Solve an issue
If you're interested in solving an issue in our repository, start by scanning through it's exisiting issues to find one that you're interested in working on. If you find an issue to work on, you are welcome to open a PR with a fix. See the following sections below for more information on contributing for specific sections.
### Documentation
The official documentation on GitBook open can be found directly in this Readme. Any updates or changes you would like to make, you can make directly to the README of this repository.
## Contributing
### Make changes locally
Any contribution you make can be made to the code located in this repository. In order to contribute, you'll need to start off of a local version of this repository.
#### 1. Fork the repository
##### Using GitHub Desktop:
- [Getting started with GitHub Desktop](https://docs.github.com/en/desktop/installing-and-configuring-github-desktop/getting-started-with-github-desktop) will guide you through setting up Desktop.
- Once Desktop is set up, you can use it to [fork the repo](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/cloning-and-forking-repositories-from-github-desktop)!
##### Using the command line:
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.
#### 2. Create a working branch and start with your changes
After forking this repository, you'll want to [create a branch](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-a-branch-for-an-issue) to work off of.
#### 3. Install dependencies and run the project locally
##### Prerequisites:
- Node.js (Version: >=20.6)
- Use `nvm` for easy Node management
- [Bun](https://bun.sh/) (Version: >=1.2.15)
- We use a text-based lockfile which isn't supported below 1.2.15
##### Setup steps:
1. Ensure you are using the project's version of Node:
```bash
nvm use
```
2. Install dependencies using Bun:
```bash
bun install
```
3. Start the development server:
```bash
bun dev
```
Additional development commands:
- `bun format`: Format the code using Biome
- `bun typecheck`: Run TypeScript type checking
- `bun unit`: Run unit tests
- `bun e2e`: Run end-to-end tests
#### 4. Preview your changes
When running the development server, published GitBook sites can be rendered through your local version at `http://localhost:3000/url`.
For example, our published docs can be viewed using the local version by visiting `http://localhost:3000/url/gitbook.com/docs` after running the development server.
You can visit any published GitBook site behind your development server. Please make sure your site is [published publicly](https://gitbook.com/docs/published-documentation/publish-your-content-as-a-docs-site) to ensure you can view the site correctly in your development version.
### Commit your update
[Commit your changes](https://github.com/git-guides/git-commit) once you are happy with them. See [Atom's contributing guide](https://github.com/atom/atom/blob/master/CONTRIBUTING.md#git-commit-messages) to know how to use emoji for commit messages!
Once your changes are ready, don't forget to self-review your code to double check that your chagnes are ready to be added.
### Pull Request
When you're finished with the changes, [create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request), also known as a PR.
- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one.
- Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge. Once you submit your PR, a GitBook team member will review your proposal. We may ask questions or request for additional information.
- We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch.
- As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations).
- If you run into any merge issues, checkout this [git tutorial](https://lab.github.com/githubtraining/managing-merge-conflicts) to help you resolve merge conflicts and other issues.
### Your PR is merged
Congratulations 🎉 Thank you for your contribution! Once your PR is merged, your contributions will be publicly visible on the relevant repository.
+18
View File
@@ -0,0 +1,18 @@
---
name: Bug report
about: Something not working as expected? Let us look into it
labels: bug
---
## Bug description
_Please describe._
_If this affects the front-end, screenshots would be of great help._
## How to reproduce
1.
2.
3.
## Additional context
@@ -0,0 +1,83 @@
name: Gradual Deploy to Cloudflare
description: Use gradual deployment to deploy to Cloudflare. This action will upload the middleware and server versions to Cloudflare and kept them bound together
inputs:
apiToken:
description: 'Cloudflare API token'
required: true
accountId:
description: 'Cloudflare account ID'
required: true
environment:
description: 'Cloudflare environment to deploy to (staging, production, preview)'
required: true
middlewareVersionId:
description: 'Middleware version ID to deploy'
required: true
serverVersionId:
description: 'Server version ID to deploy'
required: true
outputs:
deployment-url:
description: "Deployment URL"
value: ${{ steps.deploy_middleware.outputs.deployment-url }}
runs:
using: 'composite'
steps:
- id: wrangler_status
name: Check wrangler deployment status
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: deployments status --config ./packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc
# This step is used to get the version ID that is currently deployed to Cloudflare.
- id: extract_current_version
name: Extract current version
shell: bash
run: |
version_id=$(echo "${{ steps.wrangler_status.outputs.command-output }}" | grep -A 3 "(100%)" | grep -oP '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
echo "version_id=$version_id" >> $GITHUB_OUTPUT
- id: deploy_server
name: Deploy server to Cloudflare at 0%
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: versions deploy ${{ steps.extract_current_version.outputs.version_id }}@100% ${{ inputs.serverVersionId }}@0% -y --config ./packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc
# Since we use version overrides headers, we can directly deploy the middleware to 100%.
- id: deploy_middleware
name: Deploy middleware to Cloudflare at 100%
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: versions deploy ${{ inputs.middlewareVersionId }}@100% -y --config ./packages/gitbook/openNext/customWorkers/middlewareWrangler.jsonc
- name: Deploy server to Cloudflare at 100%
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: versions deploy ${{ inputs.serverVersionId }}@100% -y --config ./packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc
- name: Outputs
shell: bash
env:
DEPLOYMENT_URL: ${{ steps.deploy_middleware.outputs.deployment-url }}
run: |
echo "URL: ${{ steps.deploy_middleware.outputs.deployment-url }}"
@@ -0,0 +1,138 @@
name: 'Deploy cloudflare'
description: 'Deploy GitBook to Cloudflare'
inputs:
opItem:
description: '1Password item to load secrets from'
required: true
opServiceAccount:
description: '1Password service account token'
required: true
apiToken:
description: 'Cloudflare API token'
required: true
accountId:
description: 'Cloudflare account ID'
required: true
environment:
description: 'Cloudflare environment to deploy to (staging, production, preview)'
required: true
deploy:
description: 'Deploy as main version for all traffic instead of uploading versions'
required: true
commitTag:
description: 'Commit branch to associate with the deployment'
required: true
commitMessage:
description: 'Commit message to associate with the deployment'
required: true
outputs:
deployment-url:
description: "Deployment URL"
value: ${{ steps.upload_middleware.outputs.deployment-url }}
runs:
using: 'composite'
steps:
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
shell: bash
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Load secret
uses: 1password/load-secrets-action@v2
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ inputs.opServiceAccount }}
GITBOOK_URL: ${{ inputs.opItem }}/GITBOOK_URL
GITBOOK_ICONS_URL: ${{ inputs.opItem }}/GITBOOK_ICONS_URL
GITBOOK_ICONS_TOKEN: ${{ inputs.opItem }}/GITBOOK_ICONS_TOKEN
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ inputs.opItem }}/NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
GITBOOK_SECRET: ${{ inputs.opItem }}/GITBOOK_SECRET
GITBOOK_APP_URL: ${{ inputs.opItem }}/GITBOOK_APP_URL
GITBOOK_API_URL: ${{ inputs.opItem }}/GITBOOK_API_URL
GITBOOK_API_PUBLIC_URL: ${{ inputs.opItem }}/GITBOOK_API_PUBLIC_URL
GITBOOK_API_TOKEN: ${{ inputs.opItem }}/GITBOOK_API_TOKEN
GITBOOK_INTEGRATIONS_HOST: ${{ inputs.opItem }}/GITBOOK_INTEGRATIONS_HOST
GITBOOK_IMAGE_RESIZE_SIGNING_KEY: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_SIGNING_KEY
GITBOOK_IMAGE_RESIZE_URL: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_URL
GITBOOK_IMAGE_RESIZE_MODE: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_MODE
GITBOOK_ASSETS_PREFIX: ${{ inputs.opItem }}/GITBOOK_ASSETS_PREFIX
GITBOOK_FONTS_URL: ${{ inputs.opItem }}/GITBOOK_FONTS_URL
- name: Build worker
run: bun run turbo build:cloudflare
env:
GITBOOK_RUNTIME: cloudflare
shell: bash
- name: Upload the DO worker
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: deploy --config ./packages/gitbook/openNext/customWorkers/doWrangler.jsonc
- id: upload_server
name: Upload server to Cloudflare
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: ${{ format('versions upload --tag {0} --message "{1}"', inputs.commitTag, inputs.commitMessage) }} --config ./packages/gitbook/openNext/customWorkers/defaultWrangler.jsonc
- name: Extract server version worker ID
shell: bash
id: extract_server_version_id
run: |
version_id=$(echo '${{ steps.upload_server.outputs.command-output }}' | grep "Worker Version ID" | awk '{print $4}')
echo "version_id=$version_id" >> $GITHUB_OUTPUT
- name: Run updateWrangler scripts
shell: bash
run: |
bun run ./packages/gitbook/openNext/customWorkers/script/updateWrangler.ts ${{ steps.extract_server_version_id.outputs.version_id }}
- id: upload_middleware
name: Upload middleware to Cloudflare
uses: cloudflare/wrangler-action@v3.14.0
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
workingDirectory: ./
wranglerVersion: '4.10.0'
environment: ${{ inputs.environment }}
command: ${{ format('versions upload --tag {0} --message "{1}"', inputs.commitTag, inputs.commitMessage) }} --config ./packages/gitbook/openNext/customWorkers/middlewareWrangler.jsonc
- name: Extract middleware version worker ID
shell: bash
id: extract_middleware_version_id
run: |
version_id=$(echo '${{ steps.upload_middleware.outputs.command-output }}' | grep "Worker Version ID" | awk '{print $4}')
echo "version_id=$version_id" >> $GITHUB_OUTPUT
- name: Deploy server and middleware to Cloudflare
if: ${{ inputs.deploy == 'true' }}
uses: ./.github/actions/gradual-deploy-cloudflare
with:
apiToken: ${{ inputs.apiToken }}
accountId: ${{ inputs.accountId }}
opServiceAccount: ${{ inputs.opServiceAccount }}
opItem: ${{ inputs.opItem }}
environment: ${{ inputs.environment }}
serverVersionId: ${{ steps.extract_server_version_id.outputs.version_id }}
middlewareVersionId: ${{ steps.extract_middleware_version_id.outputs.version_id }}
deploy: ${{ inputs.deploy }}
- name: Outputs
shell: bash
env:
DEPLOYMENT_URL: ${{ steps.upload_middleware.outputs.deployment-url }}
run: |
echo "URL: ${{ steps.upload_middleware.outputs.deployment-url }}"
echo "Output server: ${{ steps.upload_server.outputs.command-output }}"
@@ -0,0 +1,80 @@
name: 'Deploy vercel'
description: 'Deploy GitBook to Vercel'
inputs:
vercelOrg:
description: 'Vercel organization'
required: true
vercelProject:
description: 'Vercel project'
required: true
vercelToken:
description: 'Vercel token'
required: true
opItem:
description: '1Password item to load secrets from'
required: true
opServiceAccount:
description: '1Password service account token'
required: true
environment:
description: 'Environment to deploy to'
required: true
outputs:
deployment-url:
description: "Deployment URL"
value: ${{ steps.deploy.outputs.deployment-url }}
runs:
using: 'composite'
steps:
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
shell: bash
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Pull Vercel Environment Information
run: bun run vercel pull --yes --environment=${{ inputs.environment }} --token=${{ inputs.vercelToken }}
shell: bash
env:
VERCEL_ORG_ID: ${{ inputs.vercelOrg }}
VERCEL_PROJECT_ID: ${{ inputs.vercelProject }}
- name: Load secret
uses: 1password/load-secrets-action@v2
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ inputs.opServiceAccount }}
GITBOOK_URL: ${{ inputs.opItem }}/GITBOOK_URL
GITBOOK_ICONS_URL: ${{ inputs.opItem }}/GITBOOK_ICONS_URL
GITBOOK_ICONS_TOKEN: ${{ inputs.opItem }}/GITBOOK_ICONS_TOKEN
GITBOOK_SECRET: ${{ inputs.opItem }}/GITBOOK_SECRET
GITBOOK_APP_URL: ${{ inputs.opItem }}/GITBOOK_APP_URL
GITBOOK_API_URL: ${{ inputs.opItem }}/GITBOOK_API_URL
GITBOOK_API_PUBLIC_URL: ${{ inputs.opItem }}/GITBOOK_API_PUBLIC_URL
GITBOOK_API_TOKEN: ${{ inputs.opItem }}/GITBOOK_API_TOKEN
GITBOOK_INTEGRATIONS_HOST: ${{ inputs.opItem }}/GITBOOK_INTEGRATIONS_HOST
GITBOOK_IMAGE_RESIZE_SIGNING_KEY: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_SIGNING_KEY
GITBOOK_IMAGE_RESIZE_URL: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_URL
GITBOOK_IMAGE_RESIZE_MODE: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_MODE
GITBOOK_ASSETS_PREFIX: ${{ inputs.opItem }}/GITBOOK_ASSETS_PREFIX
GITBOOK_FONTS_URL: ${{ inputs.opItem }}/GITBOOK_FONTS_URL
- name: Build Project Artifacts
run: bun run vercel build --target=${{ inputs.environment }} --token=${{ inputs.vercelToken }}
shell: bash
env:
VERCEL_ORG_ID: ${{ inputs.vercelOrg }}
VERCEL_PROJECT_ID: ${{ inputs.vercelProject }}
GITBOOK_RUNTIME: vercel
- name: Deploy Project Artifacts to Vercel
id: deploy
shell: bash
run: |
DEPLOYMENT_URL=$(bun run vercel deploy --prebuilt --target=${{ inputs.environment }} --token=${{ inputs.vercelToken }})
echo "deployment-url=$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT"
env:
VERCEL_ORG_ID: ${{ inputs.vercelOrg }}
VERCEL_PROJECT_ID: ${{ inputs.vercelProject }}
- name: Outputs
shell: bash
run: |
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
+9
View File
@@ -0,0 +1,9 @@
name: 'Setup Bun'
description: 'Install Bun and cache dependencies'
runs:
using: 'composite'
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: 'package.json'
+68
View File
@@ -0,0 +1,68 @@
name: CI
on:
pull_request:
push:
branches:
- main
env:
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
jobs:
format:
runs-on: ubuntu-latest
name: Format
timeout-minutes: 6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- run: bun format:check
test:
runs-on: ubuntu-latest
name: Test
timeout-minutes: 6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- run: bun unit
build-oss:
# CI to check that the repository builds correctly on a machine without the credentials
runs-on: ubuntu-latest
name: Build (Open Source)
timeout-minutes: 6
env:
NPM_TOKEN_READONLY: ''
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- run: bun run build
typecheck:
runs-on: ubuntu-latest
name: Typecheck
timeout-minutes: 6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- run: bun typecheck
+220
View File
@@ -0,0 +1,220 @@
name: Preview
on:
pull_request:
push:
branches:
- main
env:
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
jobs:
deploy-v2-vercel:
name: Deploy v2 to Vercel (preview)
runs-on: ubuntu-latest
environment:
name: 2v-preview
url: ${{ steps.deploy.outputs.deployment-url }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to Vercel
id: deploy
uses: ./.github/composite/deploy-vercel
with:
environment: preview
vercelOrg: ${{ secrets.VERCEL_ORG_ID }}
vercelProject: ${{ secrets.VERCEL_PROJECT_ID }}
vercelToken: ${{ secrets.VERCEL_TOKEN }}
opItem: op://gitbook-open/2v-preview
opServiceAccount: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
deploy-v2-cloudflare:
name: Deploy v2 to Cloudflare Worker (preview)
runs-on: ubuntu-latest
environment:
name: 2c-preview
url: ${{ steps.deploy.outputs.deployment-url }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url || steps.extract-worker-id.outputs.worker-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to Cloudflare
id: deploy
uses: ./.github/composite/deploy-cloudflare
with:
environment: preview
deploy: ${{ github.ref == 'refs/heads/main' }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
opItem: op://gitbook-open/2c-preview
opServiceAccount: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
commitTag: ${{ github.ref == 'refs/heads/main' && 'main' || format('pr{0}', github.event.pull_request.number) }}
commitMessage: ${{ github.sha }}
- name: Extract Worker ID
id: extract-worker-id
if: ${{ !steps.deploy.outputs.deployment-url }}
run: |
if [[ "${{ steps.deploy.outputs.command-output }}" =~ Worker\ Version\ ID:\ ([0-9a-f]{8})-([0-9a-f-]+) ]]; then
WORKER_ID_FIRST_PART="${BASH_REMATCH[1]}"
echo "worker-url=https://${WORKER_ID_FIRST_PART}-gitbook-open-v2-preview.gitbook.workers.dev/" >> $GITHUB_OUTPUT
fi
- name: Outputs
run: |
echo "URL: ${{ steps.deploy.outputs.deployment-url || steps.extract-worker-id.outputs.worker-url }}"
comment-deployments:
runs-on: ubuntu-latest
name: Comment Deployments (preview)
if: always() && !startsWith(github.ref, 'refs/heads/main')
needs:
- deploy-v2-vercel
- deploy-v2-cloudflare
steps:
- name: Find GitHub Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Summary of the deployments'
- name: Create or update GitHub comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Summary of the deployments:
| Version | URL | Status |
| --- | --- | --- |
| Vercel | [${{ needs.deploy-v2-vercel.outputs.deployment-url }}](${{ needs.deploy-v2-vercel.outputs.deployment-url }}) | ${{ needs.deploy-v2-vercel.result == 'success' && '✅' || '❌' }} |
| Cloudflare | [${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}](${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}) | ${{ needs.deploy-v2-cloudflare.result == 'success' && '✅' || '❌' }} |
### Test content
| Site | `2v` | `2c` |
| --- | --- | --- |
| GitBook | [${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/gitbook.com/docs](${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/gitbook.com/docs) | [${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/gitbook.com/docs](${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/gitbook.com/docs) |
| E2E | [${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/gitbook.gitbook.io/test-gitbook-open](${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/gitbook.gitbook.io/test-gitbook-open) | [${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/gitbook.gitbook.io/test-gitbook-open](${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/gitbook.gitbook.io/test-gitbook-open) |
edit-mode: replace
visual-testing-v2-vercel:
runs-on: ubuntu-latest
name: Visual Testing v2
needs: deploy-v2-vercel
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Run Playwright tests
run: bun e2e
env:
BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}
SITE_BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_BUILD_NAME: 'v2-vercel'
visual-testing-v2-cloudflare:
runs-on: ubuntu-latest
name: Visual Testing v2 (Cloudflare)
needs: deploy-v2-cloudflare
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Run Playwright tests
run: bun e2e
env:
BASE_URL: ${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}
SITE_BASE_URL: ${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_BUILD_NAME: 'v2-cloudflare'
visual-testing-customers-v2:
runs-on: ubuntu-latest
name: Visual Testing Customers v2
needs: deploy-v2-vercel
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Run Playwright tests
run: bun e2e-customers
env:
BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}
SITE_BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_BUILD_NAME: 'customers-v2'
visual-testing-customers-v2-cloudflare:
runs-on: ubuntu-latest
name: Visual Testing Customers v2 (Cloudflare)
needs: deploy-v2-cloudflare
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Run Playwright tests
run: bun e2e-customers
env:
BASE_URL: ${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}
SITE_BASE_URL: ${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_BUILD_NAME: 'customers-v2'
browserless-testing-v2-vercel:
runs-on: ubuntu-latest
name: Browserless Testing v2 (Vercel)
needs: deploy-v2-vercel
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Run tests
run: cd ./packages/gitbook && bun e2e-browserless
env:
BASE_URL: ${{needs.deploy-v2-vercel.outputs.deployment-url}}
SITE_BASE_URL: ${{ needs.deploy-v2-vercel.outputs.deployment-url }}/url/
# browserless-testing-v2-cloudflare:
# runs-on: ubuntu-latest
# name: Browserless Testing v2 (Cloudflare)
# needs: deploy-v2-cloudflare
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Setup Bun
# uses: ./.github/composite/setup-bun
# - name: Install dependencies
# run: bun install --frozen-lockfile
# env:
# PUPPETEER_SKIP_DOWNLOAD: 1
# - name: Run tests
# run: cd ./packages/gitbook && bun e2e-browserless
# env:
# BASE_URL: ${{needs.deploy-v2-cloudflare.outputs.deployment-url}}
# SITE_BASE_URL: ${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/
+55
View File
@@ -0,0 +1,55 @@
name: Production
on:
push:
branches:
- main
env:
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
jobs:
deploy-v2-vercel:
name: Deploy v2 to Vercel (production)
runs-on: ubuntu-latest
environment:
name: 2v-production
url: ${{ steps.deploy.outputs.deployment-url }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
id: deploy
uses: ./.github/composite/deploy-vercel
with:
environment: production
vercelOrg: ${{ secrets.VERCEL_ORG_ID }}
vercelProject: ${{ secrets.VERCEL_PROJECT_ID }}
vercelToken: ${{ secrets.VERCEL_TOKEN }}
opItem: op://gitbook-open/2v-production
opServiceAccount: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
deploy-v2-cloudflare:
name: Deploy v2 to Cloudflare Worker (production)
runs-on: ubuntu-latest
environment:
name: 2c-production
url: ${{ steps.deploy.outputs.deployment-url }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
id: deploy
uses: ./.github/composite/deploy-cloudflare
with:
environment: production
deploy: true
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
opItem: op://gitbook-open/2c-production
opServiceAccount: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
commitTag: main
commitMessage: ${{ github.sha }}
- name: Outputs
run: |
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
+55
View File
@@ -0,0 +1,55 @@
name: Staging
on:
push:
branches:
- main
env:
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
jobs:
deploy-v2-vercel:
name: Deploy v2 to Vercel (staging)
runs-on: ubuntu-latest
environment:
name: 2v-staging
url: ${{ steps.deploy.outputs.deployment-url }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
id: deploy
uses: ./.github/composite/deploy-vercel
with:
environment: staging
vercelOrg: ${{ secrets.VERCEL_ORG_ID }}
vercelProject: ${{ secrets.VERCEL_PROJECT_ID }}
vercelToken: ${{ secrets.VERCEL_TOKEN }}
opItem: op://gitbook-open/2v-staging
opServiceAccount: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
deploy-v2-cloudflare:
name: Deploy v2 to Cloudflare Worker (staging)
runs-on: ubuntu-latest
environment:
name: 2c-staging
url: ${{ steps.deploy.outputs.deployment-url }}
outputs:
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy
id: deploy
uses: ./.github/composite/deploy-cloudflare
with:
environment: staging
deploy: true
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
opItem: op://gitbook-open/2c-staging
opServiceAccount: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
commitTag: main
commitMessage: ${{ github.sha }}
- name: Outputs
run: |
echo "URL: ${{ steps.deploy.outputs.deployment-url }}"
+42
View File
@@ -0,0 +1,42 @@
name: Publish
on:
push:
branches:
- main
env:
NPM_TOKEN_READONLY: ${{ secrets.NPM_TOKEN_READONLY }}
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Bun
uses: ./.github/composite/setup-bun
- name: Install dependencies
run: bun install --frozen-lockfile
env:
PUPPETEER_SKIP_DOWNLOAD: 1
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
version: npm run changeset-version
env:
# 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 }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+24 -24
View File
@@ -1,27 +1,27 @@
# Logs
logs
*.log
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
# dependencies
node_modules
/.pnp
.pnp.js
theme/javascript/vendors
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Turbo
.turbo
# Vercel
.vercel
# Env files
.env.local
# TypeScript
*.tsbuildinfo
+1
View File
@@ -0,0 +1 @@
v20.6
-5
View File
@@ -1,5 +0,0 @@
language: node_js
node_js:
- "0.11"
- "0.10"
- "0.8"
+3
View File
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome"]
}
+21
View File
@@ -0,0 +1,21 @@
{
"tailwindCSS.experimental.classRegex": [
["Style \\=([^;]*);", "'([^']*)'"],
["Style \\=([^;]*);", "\"([^\"]*)\""],
["Style \\=([^;]*);", "\\`([^\\`]*)\\`"],
["style \\=([^;]*);", "'([^']*)'"],
["style \\=([^;]*);", "\"([^\"]*)\""],
["style \\=([^;]*);", "\\`([^\\`]*)\\`"]
],
"tailwindCSS.classAttributes": ["class", "className", "style", ".*Style"],
"prettier.enable": false,
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"source.fixAll.biome": "explicit"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
-18
View File
@@ -1,18 +0,0 @@
Authors
=======
Also see https://github.com/GitbookIO/gitbook/graphs/contributors.
Names below are ordered by first contribution.
Author
------
- Samy Pessé <samypesse@gmail.com>
- Aaron O'Mullan <aaron.omullan@gmail.com>
Contributors
------------
- Nijiko Yonskai
- Herman Starikov
-2
View File
@@ -1,2 +0,0 @@
# Release notes
-80
View File
@@ -1,80 +0,0 @@
module.exports = function (grunt) {
var path = require("path");
// Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks("grunt-bower-install-simple");
// Init GRUNT configuraton
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
'bower-install-simple': {
options: {
color: true,
production: false,
directory: "theme/javascript/vendors"
}
},
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
"theme/assets/style.css": "theme/stylesheets/main.less",
"theme/assets/print.css": "theme/stylesheets/print.less"
}
}
},
requirejs: {
compile: {
options: {
name: "gitbook",
baseUrl: "theme/javascript/",
out: "theme/assets/app.js",
preserveLicenseComments: false,
optimize: "uglify", //"uglify",
include: ["requireLib"],
paths: {
"jQuery": 'vendors/jquery/dist/jquery',
"lodash": 'vendors/lodash/dist/lodash',
"requireLib": 'vendors/requirejs/require',
"Mousetrap": 'vendors/mousetrap/mousetrap',
"lunr": 'vendors/lunr.js/lunr',
"URI": 'vendors/URIjs/src/URI'
},
shim: {
'jQuery': {
exports: '$'
},
'lodash': {
exports: '_'
},
'Mousetrap': {
exports: 'Mousetrap'
},
'lunr': {
exports: 'lunr'
}
}
}
}
}
});
grunt.registerTask("bower-install", [ "bower-install-simple" ]);
// Build
grunt.registerTask('build', [
'bower-install',
'less',
'requirejs'
]);
grunt.registerTask('default', [
'build'
]);
};
+642 -169
View File
@@ -1,201 +1,674 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
1. Definitions.
Preamble
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
The precise terms and conditions for copying, distribution and
modification follow.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
TERMS AND CONDITIONS
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
0. Definitions.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
"This License" refers to version 3 of the GNU General Public License.
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
A "covered work" means either the unmodified Program or a work based
on the Program.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
1. Source Code.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
END OF TERMS AND CONDITIONS
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
APPENDIX: How to apply the Apache License to your work.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
Copyright 2014 FriendCode Inc.
The Corresponding Source for a work in source code form is that
same work.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
2. Basic Permissions.
http://www.apache.org/licenses/LICENSE-2.0
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+126 -169
View File
@@ -1,219 +1,176 @@
GitBook
=======
<h1 align="center">GitBook</h1>
[![Build Status](https://travis-ci.org/GitbookIO/gitbook.png?branch=master)](https://travis-ci.org/GitbookIO/gitbook)
<p align="center">
<a href="https://gitbook.com/docs/">Docs</a> - <a href="https://github.com/GitbookIO/community">Community</a> - <a href="https://developer.gitbook.com/">Developer Docs</a> - <a href="https://changelog.gitbook.com/">Changelog</a> - <a href="https://github.com/GitbookIO/gitbook/issues/new?assignees=&labels=bug&template=bug_report.md">Bug reports</a> - <a href="https://github.com/orgs/GitbookIO/discussions/categories/feature-requests">Feature requests</a>
</p>
GitBook is a command line tool (and Node.js library) for building beautiful books and exercises using GitHub/Git and Markdown. You can see an example: [Learn Javascript](https://www.gitbook.io/book/GitBookIO/javascript). An [editor](https://github.com/GitbookIO/editor) is available for Windows, Mac and Linux. You can follow [@GitBookIO](https://twitter.com/GitBookIO) on Twitter.
<p align="center">
<a href="https://gitbook.com"><img src="https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1"></a>
<a href="#"><img src="https://img.shields.io/badge/Open_Source-❤️-FDA599?"/></a>
<a href="/LICENSE"><img src="https://img.shields.io/badge/License-GNU_GPLv3-F4E28D"/></a>
<a href="/.github/CONTRIBUTING.md"><img src="https://img.shields.io/github/contributors/gitbookIO/gitbook"/></a>
<a href="https://github.com/gitbookIO/gitbook/issues"><img src="https://img.shields.io/github/issues/gitbookIO/gitbook"/></a>
</p>
![Image](https://raw.github.com/GitbookIO/gitbook/master/preview.png)
<p align="center">Welcome to GitBook, the platform for managing technical knowledge for teams.</p>
## How to use it:
<p align="center">This repository contains the open source code used to render GitBook's published content.</p>
GitBook can be installed from **NPM** using:
<p align="center">
<img alt="GitBook Open Published Site" src="./assets/published-site.png">
</p>
## Table of Contents
- [Getting Started](#getting-started)
- [Contributing](#contributing)
- [Types of contributions](#types-of-contributions)
- [Licensing](#license)
- [Acknowledgements](#acknowledgements)
- [Legacy GitBook](#legacy-gitbook-deprecated)
## Getting Started
To run a local version of this project, please follow these simple steps.
### Prerequisites
- Node.js (Version: >=20.6)
- Use nvm for easy Node management
- [Bun](https://bun.sh/) (Version: >=1.2.15)
- We use a text-based lockfile which isn't supported below 1.2.15
### Set up
1. Clone the repo into a **public** GitHub repository. If you plan to distribute the code, keep the source code public to comply with GNU GPLv3. To clone in a private repository, acquire a [commercial license](https://www.gitbook.com/pricing).
```
$ npm install gitbook -g
git clone https://github.com/gitbookIO/gitbook.git
```
You can serve a repository as a book using:
2. Ensure you are using the project's version of `node`. Running `nvm use` will change your local version to the correct one.
3. Install the project's dependencies through Bun.
```
$ gitbook serve ./repository
bun install
```
Or simply build the static website using:
4. Start your local development server.
```
$ gitbook build ./repository --output=./outputFolder
bun dev
```
Options for commands `build` and `serve` are:
6. Open a published GitBook space in your web browser, prefixing it with `http://localhost:3000/url`.
examples:
- http://localhost:3000/url/gitbook.com/docs
- http://localhost:3000/url/open-source.gitbook.io/midjourney
Any published GitBook site can be accessed through your local development instance, and any updates you make to the codebase will be reflected in your browser.
### CI and testing
All pull-requests will be tested against both visual and performances testing to prevent regressions.
## Fonts and Icons
GitBook Open uses fontawesome. During development, your local environment will use the free version. However, only the pro version will be accepted by CI. If you see the following error:
```
-o, --output <directory> Path to output directory, defaults to ./_book
-f, --format <name> Change generation format, defaults to site, availables are: site, page, pdf, json
--config <config file> Configuration file to use, defaults to book.json
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.
```
GitBook load the default configuration from a `book.json` file in the repository if it exists.
It means that you've changed the GBO dependencies and bundled in the free version. Only GitBook staff can help with this - if you're not on the GitBook team, please ping us in the PR and we'll help get things moving.
Here are the options that can be stored in this file:
If you are GitBook staff, you'll need our NPM token in your local environment.
```
{
// Folders to use for output (caution: it override the value from the command line)
"output": null,
.env.local
// Generator to use for building (caution: it override the value from the command line)
"generator": "site",
// Book title and description (defaults are extracted from the README)
"title": null,
"description": null,
// GitHub informations (defaults are extracted using git)
"github": null,
"githubHost": "https://github.com/",
// Plugins list, can contain "-name" for removing default plugins
"plugins": [],
// Global configuration for plugins
"pluginsConfig": {
"fontSettings": {
"theme": "sepia", "night" or "white",
"family": "serif" or "sans",
"size": 1 to 4
}
},
// set another theme with your own layout
// it's recommended to use plugins or add more options for default theme, though
// see https://github.com/GitbookIO/gitbook/issues/209
"theme": "./localtheme",
// Links in template (null: default, false: remove, string: new value)
"links": {
// Link to home in the top-left corner
"home": null,
// Links in top of sidebar
"about": null,
"issues": null,
"contribute": null,
// Sharing links
"sharing": {
"google": null,
"facebook": null,
"twitter": null
}
}
}
NPM_TOKEN_READONLY=xxx
```
You can publish your books to our index by visiting [GitBook.io](http://www.gitbook.io)
and then reinstall dependencies.
## Output Formats
## Contributing
GitBook can generate your book in the following formats:
GitBook's rendering engine is fully open source and built on top of [Next.js](https://nextjs.org/). Head to our [contributing guide](https://github.com/GitbookIO/gitbook/blob/main/.github/CONTRIBUTING.md) to learn more about the workflow on adding your first Pull Request.
* **Static Website**: This is the default format, it generates a complete interactive static website that can be for example hosted on GitHub Pages.
* **PDF**: A complete PDF book with exercise solutions at the end of the book. Generate to this format using: ```gitbook pdf ./myrepo```, you need to have [gitbook-pdf](https://github.com/GitbookIO/gitbook-pdf) installed.
* **eBook**: A complete eBook with exercise solutions at the end of the book. Generate to this format using: ```gitbook ebook ./myrepo```, you need to have [ebook-convert](http://manual.calibre-ebook.com/cli/ebook-convert.html) installed.
* **Single Page**: The book will be stored in a single printable HTML page, this format is used for conversion to PDF or eBook. Generate to this format using: ```gitbook build ./myrepo -f page```.
* **JSON**: This format is used for debugging or extracting metadata from a book. Generate to this format using: ```gitbook build ./myrepo -f json```.
### Types of contributions
## Book Format
We encourage you to contribute to GitBook to help us build the best tool for documenting technical knowledge. If you're looking for some quick ways to contribute, continue reading to learn more about popular contributions.
A book is a Git repository containing at least 2 files: `README.md` and `SUMMARY.md`.
#### Translations
#### README.md
The GitBook UI is rendered using a set of translation files found in [`packages/gitbook/src/intl/translations`](/packages/gitbook/src/intl/translations/). We welcome all additional translations for the UI.
As usual, it should contains an introduction for your book. It will be automatically added to the final summary.
#### Bugs
#### SUMMARY.md
Encounter a bug or find an issue you'd like to fix? Helping us fix issues related to GitBook greatly improves the experience for everyone. Head to the issues section of this repository to learn more about the types of bugs you can already help out with.
The `SUMMARY.md` defines your book's structure. It should contain a list of chapters, linking to their respective pages.
## Deployment
Example:
> [!WARNING]
> While it is possible to self-host this project, we do not recommend this unless you are certain this option fits your need.
>
> _Looking to add a specific feature in GitBook? Head to our [contributing guide](https://github.com/GitbookIO/gitbook/blob/main/.github/CONTRIBUTING.md) to get started._
>
> Self-hosting this project puts the responsibility of maintaining and merging future updates on **you**. We cannot guarantee support, maintenance, or updates to forked and self-hosted instances of this project.
>
> We want to make it as easy as possible for our community to collaborate and push the future of GitBook, which is why we encourage you to contribute to our product directly instead of creating your own version.
```
# Summary
This project allows you to self-host the rendering portion of your GitBook published content. Self-hosting has pros and cons.
This is the summary of my book.
On the pro side, you can customize the look and feel of your content, and better embed your documentation in your application.
* [section 1](section1/README.md)
* [example 1](section1/example1.md)
* [example 2](section1/example2.md)
* [section 2](section2/README.md)
* [example 1](section2/example1.md)
On the con side, you become responsible for the reliability of your published site, and keeping the renderer up-to-date with the changes made to the GitBook platform.
## License
Distributed under the [GNU GPLv3 License](https://github.com/GitBookIO/gitbook/blob/main/LICENSE).
If you plan to distribute the code, you must make the source code public to comply with the GNU GPLv3. To clone in a private repository, acquire a [commercial license](https://www.gitbook.com/pricing).
See `LICENSE` for more information.
## Badges
<p align="left">
<a href="https://gitbook.com"><img src="https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1"></a>
<a href="https://gitbook.com"><img src="https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=F4E28D"></a>
<a href="https://gitbook.com"><img src="https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=FDA599"></a>
</p>
```md
[![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://www.gitbook.com/preview?utm_source=gitbook_readme_badge&utm_medium=organic&utm_campaign=preview_documentation&utm_content=link)
```
Files that are not included in the `SUMMARY.md` will not be processed by `gitbook`.
#### Exercises
A book can contain interactive exercises (currently only in Javascript but Python and Ruby are coming soon ;) ). An exercise is a code challenge provided to the reader, which is given a code editor to write a solution which is checked against the book author's validation code.
An exercise is defined by 4 simple parts:
* Exercise **Message**/Goals (in markdown/text)
* **Initial** code to show to the user, providing a starting point
* **Solution** code, being a correct solution to the exercise
* **Validation** code that tests the correctness of the user's input
Exercises need to start and finish with a separation bar (```---``` or ```***```). It should contain 3 code elements (**base**, **solution** and **validation**). It can contain a 4th element that provides **context** code (functions, imports of libraries etc ... that shouldn't be displayed to the user).
---
Define a variable `x` equal to 10.
```js
var x =
```
```js
var x = 10;
```
```js
assert(x == 10);
```
```js
// This is context code available everywhere
// The user will be able to call magicFunc in his code
function magicFunc() {
return 3;
}
```
---
#### Multi-Languages
GitBook supports building books written in multiple languages. Each language should be a sub-directory following the normal GitBook format, and a file named `LANGS.md` should be present at the root of the repository with the following format:
```
* [English](en/)
* [French](fr/)
* [Español](es/)
```html
<a href="https://www.gitbook.com/preview?utm_source=gitbook_readme_badge&utm_medium=organic&utm_campaign=preview_documentation&utm_content=link">
<img
src="https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1"
/>
</a>
```
You can see a complete example with the [Learn Git](https://github.com/GitbookIO/git) book.
## Acknowledgements
#### Ignoring files & folders
GitBook wouldn't be possible without these projects:
GitBook will read the `.gitignore`, `.bookignore` and `.ignore` files to get a list of files and folders to skip. (The format inside those files, follows the same convention as `.gitignore`)
- [Next.js](https://nextjs.org/)
- [Bun](https://bun.sh/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Framer Motion](https://www.npmjs.com/package/framer-motion)
#### Cover
## Contributors
A cover image can be set by creating a file: **/cover.jpg**.
The best resolution is **1800x2360**. The generation of the cover can be done automatically using the plugin [autocover](https://github.com/GitbookIO/plugin-autocover).
<a href="https://github.com/gitbookIO/gitbook/graphs/contributors">
<img src="https://contrib.rocks/image?repo=gitbookIO/gitbook" />
</a>
A small version of the cover can also be set by creating a file: **/cover_small.jpg**.
## Legacy GitBook (Deprecated)
#### Publish your book
The platform [GitBook.io](https://www.gitbook.io/) is like an "Heroku for books", you can create a book on it (public, paid, or private) and update it using **git push**.
#### Plugins
Plugins can used to extend your book's functionality. Read [GitbookIO/plugin](https://github.com/GitbookIO/plugin) for more information about how to build a plugin for gitbook.
##### Default plugins:
* [mathjax](https://github.com/GitbookIO/plugin-mathjax): displays mathematical notation in the book.
* [mixpanel](https://github.com/GitbookIO/plugin-mixpanel): Mixpanel tracking for your book
##### Other plugins:
* [Google Analytics](https://github.com/GitbookIO/plugin-ga): Google Analytics tracking for your book
* [Disqus](https://github.com/GitbookIO/plugin-disqus): Disqus comments integration in your book
* [Autocover](https://github.com/GitbookIO/plugin-autocover): Generate a cover for your book
* [Transform annoted quotes to notes](https://github.com/erixtekila/gitbook-plugin-richquotes): Allow extra markdown markup to render blockquotes as nice notes
* [Send code to console](https://github.com/erixtekila/gitbook-plugin-toconsole): Evaluate javascript block in the browser inspector's console
* [Revealable sections](https://github.com/mrpotes/gitbook-plugin-reveal): Reveal sections of the page using buttons made from the first title in each section
* [Markdown within HTML](https://github.com/mrpotes/gitbook-plugin-nestedmd): Process markdown within HTML blocks - allows custom layout options for individual pages
* [Bootstrap JavaScript plugins](https://github.com/mrpotes/gitbook-plugin-bootstrapjs): Use the [Bootstrap JavaScript plugins](http://getbootstrap.com/javascript) in your online GitBook
Our previous version of GitBook and it's CLI tool are now deprecated. You can still view the old repository and it's commits on this [branch](https://github.com/GitbookIO/gitbook/tree/legacy).
Binary file not shown.

After

Width:  |  Height:  |  Size: 622 KiB

-47
View File
@@ -1,47 +0,0 @@
var path = require('path');
var Q = require('q');
var _ = require('lodash');
var fs = require('fs');
var utils = require('./utils');
var generate = require("../lib/generate");
var parse = require("../lib/parse");
var generators = require("../lib/generate").generators;
var buildCommand = function(command) {
return command
.option('-o, --output <directory>', 'Path to output directory, defaults to ./_book')
.option('-f, --format <name>', 'Change generation format, defaults to site, availables are: '+_.keys(generators).join(", "))
.option('--config <config file>', 'Configuration file to use, defualt to book.json')
};
var makeBuildFunc = function(converter) {
return function(dir, options) {
dir = dir || process.cwd();
outputDir = options.output;
console.log('Starting build ...');
return converter(
_.extend({}, options || {}, {
input: dir,
output: outputDir,
generator: options.format,
configFile: options.config
})
)
.then(function(output) {
console.log("Successfuly built !");
return output;
}, utils.logError)
.fail(function() {
process.exit(-1);
});
};
};
module.exports = {
folder: makeBuildFunc(generate.folder),
file: makeBuildFunc(generate.file),
command: buildCommand
};
-96
View File
@@ -1,96 +0,0 @@
#! /usr/bin/env node
var Q = require('q');
var _ = require('lodash');
var path = require('path');
var prog = require('commander');
var pkg = require('../package.json');
var generators = require("../lib/generate").generators;
var initDir = require("../lib/generate/init");
var fs = require('../lib/generate/fs');
var utils = require('./utils');
var build = require('./build');
var Server = require('./server');
// General options
prog
.version(pkg.version);
build.command(prog.command('build [source_dir]'))
.description('Build a gitbook from a directory')
.action(build.folder);
build.command(prog.command('serve [source_dir]'))
.description('Build then serve a gitbook from a directory')
.option('-p, --port <port>', 'Port for server to listen on', 4000)
.option('--no-watch', 'Disable restart with file watching')
.action(function(dir, options) {
var server = new Server();
var generate = function() {
if (server.isRunning()) console.log("Stopping server");
server.stop()
.then(function() {
return build.folder(dir, options);
})
.then(function(_options) {
console.log();
console.log('Starting server ...');
return server.start(_options.output, options.port)
.then(function() {
console.log('Serving book on http://localhost:'+options.port);
if (!options.watch) return;
return utils.watch(_options.input)
.then(function(filepath) {
console.log("Restart after change in files");
console.log('');
return generate();
})
})
})
.fail(utils.logError);
};
console.log('Press CTRL+C to quit ...');
console.log('')
generate();
});
build.command(prog.command('pdf [source_dir]'))
.description('Build a gitbook as a PDF')
.option('-pf, --paperformat <format>', 'PDF paper format (default is A4): "5in*7.5in", "10cm*20cm", "A4", "Letter"')
.action(function(dir, options) {
build.file(dir, _.extend(options, {
extension: "pdf",
format: "pdf"
}));
});
build.command(prog.command('ebook [source_dir]'))
.description('Build a gitbook as a eBook')
.option('-c, --cover <path>', 'Cover image, default is cover.png if exists')
.action(function(dir, options) {
var ext = options.output ? path.extname(options.output) : "epub";
build.file(dir, _.extend(options, {
extension: ext,
format: "ebook"
}));
});
prog
.command('init [source_dir]')
.description('Create files and folders based on contents of SUMMARY.md')
.action(function(dir) {
dir = dir || process.cwd();
return initDir(dir);
});
// Parse and fallback to help if no args
if(_.isEmpty(prog.parse(process.argv).args) && process.argv.length === 2) {
prog.help();
}
-96
View File
@@ -1,96 +0,0 @@
var Q = require('q');
var _ = require('lodash');
var events = require('events');
var http = require('http');
var send = require('send');
var util = require('util');
var url = require('url');
var Server = function() {
this.running = null;
this.dir = null;
this.port = 0;
this.sockets = [];
};
util.inherits(Server, events.EventEmitter);
// Return true if the server is running
Server.prototype.isRunning = function() {
return this.running != null;
};
// Stop the server
Server.prototype.stop = function() {
var that = this;
if (!this.isRunning()) return Q();
var d = Q.defer();
this.running.close(function(err) {
that.running = null;
that.emit("state", false);
if (err) d.reject(err);
else d.resolve();
});
for (var i = 0; i < this.sockets.length; i++) {
this.sockets[i].destroy();
}
return d.promise;
};
Server.prototype.start = function(dir, port) {
var that = this, pre = Q();
port = port || 8004;
if (that.isRunning()) pre = this.stop();
return pre
.then(function() {
var d = Q.defer();
that.running = http.createServer(function(req, res){
// Render error
function error(err) {
res.statusCode = err.status || 500;
res.end(err.message);
}
// Redirect to directory's index.html
function redirect() {
res.statusCode = 301;
res.setHeader('Location', req.url + '/');
res.end('Redirecting to ' + req.url + '/');
}
// Send file
send(req, url.parse(req.url).pathname)
.root(dir)
.on('error', error)
.on('directory', redirect)
.pipe(res);
});
that.running.on('connection', function (socket) {
that.sockets.push(socket);
socket.setTimeout(4000);
socket.on('close', function () {
that.sockets.splice(that.sockets.indexOf(socket), 1);
});
});
that.running.listen(port, function(err) {
if (err) return d.reject(err);
that.port = port;
that.dir = dir;
that.emit("state", true);
d.resolve();
});
return d.promise;
});
}
module.exports = Server;
-44
View File
@@ -1,44 +0,0 @@
var Q = require('q');
var _ = require('lodash');
var http = require('http');
var send = require('send');
var path = require('path');
var Gaze = require('gaze').Gaze;
function watch(dir) {
var d = Q.defer();
dir = path.resolve(dir);
var gaze = new Gaze("**/*.md", {
cwd: dir
});
gaze.once("all", function(e, filepath) {
gaze.close();
d.resolve(filepath);
});
gaze.once("error", function(err) {
gaze.close();
d.reject(err);
});
return d.promise;
}
function logError(err) {
var message = err.message || err;
if (process.env.DEBUG != null) message = err.stack || message;
console.log(message);
return Q.reject(err);
};
// Exports
module.exports = {
watch: watch,
logError: logError
};
+177
View File
@@ -0,0 +1,177 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": [
"**/node_modules/**/*",
"**/dist/**/*",
"**/build/**/*",
"**/public/**/*",
"**/.next/**/*",
"**/.open-next/**/*",
"**/.turbo/**/*",
"**/.vercel/**/*",
"**/.cache/**/*",
"**/.wrangler/**/*",
"packages/embed/standalone/**/*",
"packages/openapi-parser/src/fixtures/**/*",
"packages/emoji-codepoints/index.ts",
"packages/icons/src/data/*.json",
"packages/gitbook/worker-configuration.d.ts",
"**/*.css"
]
},
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 4,
"lineEnding": "lf",
"lineWidth": 100,
"attributePosition": "auto",
"bracketSpacing": true
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"performance": {
"noDelete": "warn"
},
"security": {
"noDangerouslySetInnerHtml": "off"
},
"complexity": {
"noForEach": "off",
"noUselessFragments": "warn",
"noBannedTypes": "warn"
},
"correctness": {
"noUndeclaredVariables": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "error",
"useHookAtTopLevel": "error",
"noUnusedImports": "error",
"noVoidElementsWithChildren": "warn",
"useJsxKeyInIterable": "warn",
"useExhaustiveDependencies": "warn",
"noUnknownFunction": "warn"
},
"style": {
"noNonNullAssertion": "warn",
"noParameterAssign": "off",
"useThrowOnlyError": "error"
},
"suspicious": {
"noConsole": {
"level": "warn",
"options": {
"allow": ["assert", "error", "warn"]
}
},
"noExplicitAny": "warn",
"noImplicitAnyLet": "warn",
"noConfusingVoidType": "warn",
"noControlCharactersInRegex": "warn",
"noPrototypeBuiltins": "warn",
"noAssignInExpressions": "warn",
"noArrayIndexKey": "warn"
},
"a11y": {
"useSemanticElements": "warn",
"useKeyWithClickEvents": "warn",
"noSvgWithoutTitle": "warn",
"useButtonType": "warn",
"useIframeTitle": "warn",
"useAltText": "warn",
"noPositiveTabindex": "warn",
"useFocusableInteractive": "warn",
"useAriaPropsForRole": "warn",
"useValidAnchor": "warn",
"noLabelWithoutControl": "warn",
"noNoninteractiveTabindex": "warn"
},
"nursery": {
"useSortedClasses": {
"level": "error",
"fix": "safe",
"options": {
"attributes": ["class", "className", "style"],
"functions": ["clsx", "tw"]
}
}
}
}
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "es5",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSameLine": false,
"quoteStyle": "single",
"attributePosition": "auto",
"bracketSpacing": true
}
},
"overrides": [
{
"include": [
"packages/gitbook/**/*",
"packages/react-openapi/**/*",
"packages/react-math/**/*",
"packages/react-contentkit/**/*",
"packages/icons/**/*"
],
"javascript": {
"globals": ["React"]
}
},
{
"include": ["packages/gitbook/**/*"],
"javascript": {
"globals": ["React", "GitBookIntegrationEvent"]
}
},
{
"include": ["*.css"],
"javascript": {
"globals": ["theme"]
}
},
{
"include": ["*.test.ts", "packages/gitbook/tests/**/*"],
"javascript": {
"globals": ["Bun"]
}
},
{
"include": [
"packages/cache-do/**/*",
"packages/gitbook/cf-env.d.ts",
"packages/gitbook/src/cloudflare-entrypoint.ts"
],
"javascript": {
"globals": [
"DurableObjectLocationHint",
"DurableObjectNamespace",
"DurableObjectStub",
"ContinentCode",
"Fetcher",
"ExportedHandler"
]
}
}
]
}
-12
View File
@@ -1,12 +0,0 @@
{
"name": "GitBook",
"version": "1.0.0",
"dependencies": {
"jquery": "2.1.1",
"lodash": "2.4.1",
"requirejs": "2.1.11",
"URIjs": "1.13.1",
"mousetrap": "1.4.6",
"lunr.js": "0.5.2"
}
}
+5688
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -0,0 +1,2 @@
[install.scopes]
"gitbook" = { token = "$NPM_TOKEN_READONLY", url = "https://registry.npmjs.org" }
-70
View File
@@ -1,70 +0,0 @@
var util = require("util");
var path = require("path");
var Q = require("q");
var _ = require("lodash");
var exec = require('child_process').exec;
var fs = require("fs");
var parse = require("../../parse");
var BaseGenerator = require("../page");
/*
* This generator inherits from the single page generator
* and convert the page output to ebook
*/
var Generator = function() {
BaseGenerator.apply(this, arguments);
// Options for eBook generation
this.options = _.defaults(this.options, {
extension: "epub"
});
if (!this.options.cover && fs.existsSync(path.join(this.options.input, "cover.png"))) {
this.options.cover = path.join(this.options.input, "cover.png")
}
};
util.inherits(Generator, BaseGenerator);
Generator.prototype.finish = function() {
var that = this;
return BaseGenerator.prototype.finish.apply(this)
.then(function() {
var d = Q.defer();
var _options = {
"--cover": that.options.cover
};
var command = [
"ebook-convert",
path.join(that.options.output, "index.html"),
path.join(that.options.output, "index."+that.options.extension),
_.chain(_options)
.map(function(value, key) {
if (value == null) return null;
return key+"="+value;
})
.compact()
.value()
.join(" ")
].join(" ");
exec(command, function (error, stdout, stderr) {
if (error) {
if (error.code == 127) {
error.message = "Need to install ebook-convert from Calibre";
} else {
error.message = error.message + " "+stdout;
}
return d.reject(error);
}
d.resolve();
});
return d.promise;
});
};
module.exports = Generator;
-61
View File
@@ -1,61 +0,0 @@
var Q = require("q");
var fs = require("fs");
var fsExtra = require("fs-extra");
var Ignore = require("fstream-ignore");
var getFiles = function(path) {
var d = Q.defer();
// Our list of files
var files = [];
var ig = Ignore({
path: path,
ignoreFiles: ['.ignore', '.gitignore', '.bookignore']
});
// Add extra rules to ignore common folders
ig.addIgnoreRules([
'.git/',
'.gitignore',
'.DS_Store'
], '__custom_stuff');
// Push each file to our list
ig.on('child', function (c) {
files.push(
c.path.substr(c.root.path.length + 1) + (c.props.Directory === true ? '/' : '')
);
});
ig.on('end', function() {
// Normalize paths on Windows
if(process.platform === 'win32') {
return d.resolve(files.map(function(file) {
return file.replace(/\\/g, '/');
}));
}
// Simply return paths otherwise
return d.resolve(files);
});
ig.on('error', d.reject);
return d.promise;
};
module.exports = {
list: getFiles,
readFile: Q.denodeify(fs.readFile),
writeFile: Q.denodeify(fs.writeFile),
mkdirp: Q.denodeify(fsExtra.mkdirp),
copy: Q.denodeify(fsExtra.copy),
remove: Q.denodeify(fsExtra.remove),
symlink: Q.denodeify(fsExtra.symlink),
exists: function(path) {
var d = Q.defer();
fs.exists(path, d.resolve);
return d.promise;
},
};
-57
View File
@@ -1,57 +0,0 @@
var _ = require("lodash");
var path = require("path");
var Q = require("q");
var fs = require("./fs");
var Plugin = require("./plugin");
var BaseGenerator = function(options) {
this.options = options;
this.options.plugins = Plugin.normalizeNames(this.options.plugins);
this.plugins = [];
};
BaseGenerator.prototype.callHook = function(name, data) {
return this.plugins.hook(name, this, data);
};
BaseGenerator.prototype.loadPlugins = function() {
var that = this;
return Plugin.fromList(this.options.plugins, this.options.input)
.then(function(_plugins) {
that.plugins = _plugins;
return that.callHook("init");
});
};
BaseGenerator.prototype.convertFile = function(content, input) {
return Q.reject(new Error("Could not convert "+input));
};
BaseGenerator.prototype.transferFile = function(input) {
return fs.copy(
path.join(this.options.input, input),
path.join(this.options.output, input)
);
};
BaseGenerator.prototype.transferFolder = function(input) {
return fs.mkdirp(
path.join(this.options.output, input)
);
};
BaseGenerator.prototype.langsIndex = function(langs) {
return Q.reject(new Error("Langs index is not supported in this generator"));
};
BaseGenerator.prototype.finish = function() {
return Q.reject(new Error("Could not finish generation"));
};
module.exports = BaseGenerator;
-366
View File
@@ -1,366 +0,0 @@
var Q = require("q");
var _ = require("lodash");
var path = require("path");
var swig = require('swig');
var tmp = require('tmp');
var fs = require("./fs");
var parse = require("../parse");
var Plugin = require("./plugin");
var generators = {
"site": require("./site"),
"page": require("./page"),
"pdf": require("./pdf"),
"ebook": require("./ebook"),
"json": require("./json")
};
var defaultDescription = "Book generated using GitBook";
var containsFiles = function(dir, files) {
return Q.all(_.map(files, function(file) {
return fs.exists(path.join(dir, file));
}))
.then(_.all);
};
// Create the generator and load plugins
var loadGenerator = function(options) {
var generator = new generators[options.generator](options);
return generator.loadPlugins()
.then(_.constant(generator));
};
var generate = function(options) {
// Set defaults to options
options = _.defaults(options || {}, {
// Folders to use
"input": null,
"output": null,
// Config file (relative to input)
"configFile": "book.json",
// Output generator
"generator": "site",
// Book title, keyword, description
"title": null,
"description": null,
// Origin github repository id
"github": null,
"githubHost": 'https://github.com/',
// Theming
"theme": path.resolve(__dirname, '../../theme'),
// Plugins
"plugins": [],
"pluginsConfig": {},
// Links
"links": {
"about": null,
"issues": null,
"contribue": null,
}
});
// Validate options
if (!options.input) {
return Q.reject(new Error("Need option input (book input directory)"));
}
// Ensure generator exists
if (!generators[options.generator]) {
return Q.reject(new Error("Invalid generator (availables are: "+_.keys(generators).join(", ")));
}
// Check files to get folder type (book, multilanguage book or neither)
return Q()
// Read readme
.then(function() {
return fs.readFile(path.join(options.input, "README.md"), "utf-8")
.then(function(_readme) {
_readme = parse.readme(_readme);
options.title = options.title || _readme.title;
options.description = options.description || _readme.description || defaultDescription;
});
})
// Detect multi-languages book
.then(function() {
return containsFiles(options.input, ['LANGS.md'])
})
.then(function(isMultiLang) {
// Multi language book
if(isMultiLang) {
return generateMultiLang(options);
}
// Book
return generateBook(options);
});
};
var generateMultiLang = function(options) {
var langsSummary;
options.output = options.output || path.join(options.input, "_book");
// Multi-languages book
return fs.readFile(path.join(options.input, "LANGS.md"), "utf-8")
// Clean output folder
.then(function(_langsSummary) {
langsSummary = _langsSummary;
return fs.remove(options.output);
})
.then(function() {
return fs.mkdirp(options.output);
})
// Generate sub-books
.then(function() {
options.langsSummary = parse.langs(langsSummary);
// Generated a book for each valid entry
return _.reduce(options.langsSummary.list, function(prev, entry) {
return prev.then(function() {
return generate(_.extend({}, options, {
input: path.join(options.input, entry.path),
output: path.join(options.output, entry.path)
}));
})
}, Q());
})
.then(function() {
return loadGenerator(options);
})
// Generate languages index
.then(function(generator) {
return generator.langsIndex(options.langsSummary);
})
// Return options to caller
.then(_.constant(options));
};
/*
* Use a specific generator to convert a gitbook to a site/pdf/ebook/
* output is always a folder
*/
var generateBook = function(options) {
var files;
options.output = options.output || path.join(options.input, "_book");
// Check if it's a book
return containsFiles(options.input, ['SUMMARY.md', 'README.md'])
// Fail if not a book
.then(function(isBook) {
if(!isBook) {
return Q.reject(new Error("Invalid gitbook repository, need SUMMARY.md and README.md"));
}
})
// Read config file
.then(function() {
return fs.readFile(path.resolve(options.input, options.configFile))
.then(function(_config) {
// Extend current config
_config = JSON.parse(_config);
_config = _.omit(_config, 'input', 'configFile');
_.extend(options, _config);
}, function() {
// No config file: not a big deal
return Q();
});
})
// Clean output folder
.then(function() {
return fs.remove(options.output);
})
// Get repo's URL
.then(function() {
// Git deactivated
if(options.github === false) {
options.github = null;
return null;
} else if(options.github) {
// Git already specified in options
return options.github;
}
// Try auto detecting
return parse.git.url(options.input)
.then(function(_url) {
// Get ID of repo
return parse.git.githubID(_url);
}, function(err) {
return null;
})
.then(function(repoId) {
options.github = repoId;
});
})
.then(function() {
return fs.mkdirp(options.output);
})
// List all files in the repository
.then(function() {
return fs.list(options.input)
.then(function(_files) {
files = _files;
});
})
.then(function() {
return loadGenerator(options);
})
// Detect multi-languages book
.then(function(generator) {
// Generate the book
return Q()
// Get summary
.then(function() {
return fs.readFile(path.join(options.input, "SUMMARY.md"), "utf-8")
.then(function(_summary) {
options.summary = parse.summary(_summary);
// Parse navigation
options.navigation = parse.navigation(options.summary);
});
})
// Skip processing some files
.then(function() {
files = _.filter(files, function (file) {
return !(
file === 'SUMMARY.md'
);
});
})
// Copy file and replace markdown file
.then(function() {
return Q.all(
_.chain(files)
.map(function(file) {
if (!file) return;
if (file[file.length -1] == "/") {
return Q(generator.transferFolder(file));
} else if (path.extname(file) == ".md" && options.navigation[file] != null) {
return fs.readFile(path.join(options.input, file), "utf-8")
.then(function(content) {
return Q(generator.convertFile(content, file));
});
} else {
return Q(generator.transferFile(file));
}
})
.value()
);
})
// Finish generation
.then(function() {
return generator.finish();
})
.then(function() {
return generator.callHook("finish");
});
})
// Return all options
.then(function() {
return options;
});
};
/*
* Extract files from generate output in a temporary folder
*/
var generateFile = function(options) {
options = _.defaults(options || {}, {
input: null,
output: null,
extension: null
});
return Q.nfcall(tmp.dir)
.then(function(tmpDir) {
return generate(
_.extend({},
options,
{
output: tmpDir
})
)
.then(function(_options) {
var ext = options.extension;
var outputFile = options.output || path.resolve(options.input, "book."+ext);
var copyFile = function(lang) {
var _outputFile = outputFile;
var _tmpDir = tmpDir;
if (lang) {
_outputFile = _outputFile.slice(0, -path.extname(_outputFile).length)+"_"+lang+path.extname(_outputFile);
_tmpDir = path.join(_tmpDir, lang);
}
return fs.copy(
path.join(_tmpDir, "index."+ext),
_outputFile
);
};
// Multi-langs book
return Q()
.then(function() {
if (_options.langsSummary) {
return Q.all(
_.map(_options.langsSummary.list, function(lang) {
return copyFile(lang.lang);
})
);
} else {
return copyFile();
}
})
.then(function() {
return fs.remove(tmpDir);
});
});
});
};
module.exports = {
generators: generators,
folder: generate,
file: generateFile,
book: generateBook,
Plugin: Plugin,
};
-69
View File
@@ -1,69 +0,0 @@
var Q = require('q');
var _ = require('lodash');
var path = require('path');
var fs = require('./fs');
var parse = require('../parse');
// Extract paths out of a summary
function paths(summary) {
return _.reduce(summary.chapters, function(accu, chapter) {
return accu.concat(
_.filter([chapter.path].concat(_.pluck(chapter.articles, 'path')))
);
}, []);
}
// Get the parent folders out of a group of files
function folders(files) {
return _.chain(files)
.map(function(file) {
return path.dirname(file);
})
.uniq()
.value();
}
function initDir(dir) {
return fs.readFile(path.join(dir, 'SUMMARY.md'), 'utf8')
.then(function(src) {
// Parse summary
return parse.summary(src);
})
.then(function(summary) {
// Extract paths from summary
return paths(summary);
})
.then(function(paths) {
// Convert to absolute paths
return _.map(paths, function(file) {
return path.resolve(file);
});
})
.then(function(files) {
// Create folders
return Q.all(_.map(folders(files), function(folder) {
return fs.mkdirp(folder);
}))
.then(_.constant(files));
})
.then(function(files) {
// Create files that don't exist
return Q.all(_.map(files, function(file) {
return fs.exists(file)
.then(function(exists) {
if(exists) return;
return fs.writeFile(file, '');
});
}));
})
.fail(function(err) {
console.error(err.stack);
});
}
// Exports
module.exports = initDir;
-64
View File
@@ -1,64 +0,0 @@
var util = require("util");
var path = require("path");
var Q = require("q");
var fs = require("../fs");
var parse = require("../../parse");
var BaseGenerator = require("../generator");
var Generator = function() {
BaseGenerator.apply(this, arguments);
};
util.inherits(Generator, BaseGenerator);
Generator.prototype.transferFile = function(input) {
// ignore
};
Generator.prototype.convertFile = function(content, input) {
var that = this;
var json = {
progress: parse.progress(this.options.navigation, input)
};
return Q()
.then(function() {
return parse.page(content, {
repo: that.options.githubId,
dir: path.dirname(input) || '/'
});
})
.then(function(sections) {
json.sections = sections;
})
.then(function() {
return fs.writeFile(
path.join(that.options.output, input.replace(".md", ".json")),
JSON.stringify(json, null, 4)
);
});
};
// Generate languages index
Generator.prototype.langsIndex = function(langs) {
var that = this;
var json = {
langs: langs.list
};
return Q()
.then(function() {
return fs.writeFile(
path.join(that.options.output, "langs.json"),
JSON.stringify(json, null, 4)
);
});
};
Generator.prototype.finish = function() {
// ignore
};
module.exports = Generator;
-72
View File
@@ -1,72 +0,0 @@
var _ = require('lodash');
var path = require('path');
var Q = require('q');
var fs = require("./fs");
var extsToIgnore = [".gz"]
var Manifest = function() {
this.revision = 0;
this.clear(Date.now());
};
// Regenerate manifest
Manifest.prototype.clear = function(revision) {
if (revision) this.revision = revision;
this.sections = {
'CACHE': {},
'NETWORK': {},
'FALLBACK': {}
};
return Q(this);
};
// Add a resource
Manifest.prototype.add = function(category, resource, value) {
if (_.isArray(resource)) {
_.each(resource, function(subres) {
this.add(category, subres, value);
}, this);
return;
}
this.sections[category][resource] = value;
};
// Add a directory in cache
Manifest.prototype.addFolder = function(folder, root, except) {
var that = this;
root = root || "/";
return fs.list(folder)
.then(function(files) {
_.each(
// Ignore diretcories
_.filter(files, function(file) {
return file.substr(-1) != "/" && !_.contains(except, path.join(root, file)) && !_.contains(extsToIgnore, path.extname(file));
}),
function(file) {
that.add("CACHE", path.join(root, file));
}
);
})
};
// Get manifest content
Manifest.prototype.dump = function() {
var lines = [
"CACHE MANIFEST",
"# Revision "+this.revision
];
_.each(this.sections, function(content, section) {
if (_.size(content) == 0) return;
lines.push("");
lines.push(section+":");
lines = lines.concat(_.keys(content));
}, this);
return Q(lines.join("\n"));
};
module.exports = Manifest;
-89
View File
@@ -1,89 +0,0 @@
var _ = require("lodash");
var util = require("util");
var path = require("path");
var Q = require("q");
var swig = require('swig');
var hljs = require('highlight.js');
var fs = require("../fs");
var parse = require("../../parse");
var BaseGenerator = require("../site");
// Swig filter: highlight coloration
swig.setFilter('code', function(code, lang) {
try {
return hljs.highlight(lang, code).value;
} catch(e) {
return hljs.highlightAuto(code).value;
}
});
/*
* This generator will generate a simple index.html which can be converted as a PDF
*/
var Generator = function() {
BaseGenerator.apply(this, arguments);
// List of pages content
this.pages = {};
};
util.inherits(Generator, BaseGenerator);
// Load all templates
Generator.prototype.loadTemplates = function() {
this.template = swig.compileFile(
this.plugins.template("page") || path.resolve(this.options.theme, 'templates/page.html')
);
};
Generator.prototype.convertFile = function(content, input) {
var that = this;
var json = {
path: input,
progress: parse.progress(this.options.navigation, input)
};
return Q()
.then(function() {
return parse.page(content, {
repo: that.options.githubId,
dir: path.dirname(input) || '/',
outdir: './',
singleFile: true
});
})
.then(function(sections) {
json.content = sections;
})
.then(function() {
that.pages[input] = json;
});
};
Generator.prototype.finish = function() {
var that = this;
var basePath = ".";
var output = path.join(this.options.output, "index.html");
return Q()
// Generate html
.then(function(pages) {
return that._writeTemplate(that.template, {
pages: that.pages,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),
}, output);
})
// Copy assets
.then(function() {
return fs.copy(
path.join(that.options.theme, "assets"),
path.join(that.options.output, "gitbook")
);
});
};
module.exports = Generator;
-56
View File
@@ -1,56 +0,0 @@
var util = require("util");
var path = require("path");
var Q = require("q");
var _ = require("lodash");
var exec = require('child_process').exec;
var fs = require("../fs");
var parse = require("../../parse");
var BaseGenerator = require("../page");
/*
* This generator inherits from the single page generator
* and convert the page output to pdf using gitbook-pdf
*/
var Generator = function() {
BaseGenerator.apply(this, arguments);
// Options for PDF generation
this.options = _.defaults(this.options, {
paperformat: "A4"
});
};
util.inherits(Generator, BaseGenerator);
Generator.prototype.finish = function() {
var that = this;
return BaseGenerator.prototype.finish.apply(this)
.then(function() {
var d = Q.defer();
var command = [
"gitbook-pdf",
"generate",
path.join(that.options.output, "index.html"),
path.join(that.options.output, "index.pdf"),
"--format="+that.options.paperformat
].join(" ");
exec(command, function (error, stdout, stderr) {
if (error) {
if (error.code == 127) {
error.message = "Need to install gitbook-pdf using: npm install gitbook-pdf -g";
} else {
error.message = error.message + " "+stdout;
}
return d.reject(error);
}
d.resolve();
});
return d.promise;
});
};
module.exports = Generator;
-192
View File
@@ -1,192 +0,0 @@
var _ = require("lodash");
var Q = require("q");
var semver = require("semver");
var path = require("path");
var url = require("url");
var fs = require("./fs");
var resolve = require('resolve');
var pkg = require("../../package.json");
var RESOURCES = ["js", "css"];
var Plugin = function(name, root) {
this.name = name;
this.root = root;
this.packageInfos = {};
this.infos = {};
_.each([
"gitbook-plugin-"+name,
"gitbook-theme-"+name,
"gitbook-"+name,
name,
], function(_name) {
if (this.load(_name, __dirname)) return false;
if (this.load(_name, path.resolve(root))) return false;
}, this);
};
// Load from a name
Plugin.prototype.load = function(name, baseDir) {
try {
var res = resolve.sync(name+"/package.json", { basedir: baseDir });
this.baseDir = path.dirname(res);
this.packageInfos = require(res);
this.infos = require(resolve.sync(name, { basedir: baseDir }));
this.name = name;
return true;
} catch (e) {
return false;
}
};
// Return resources
Plugin.prototype.getResources = function(resource) {
if (!this.infos.book || !this.infos.book[resource]) {
return [];
}
return _.chain(this.infos.book[resource])
.map(function(resource) {
var parsed = url.parse(resource);
if (parsed.protocol) return {"url": resource}
else return { "path": this.name+"/"+resource };
}.bind(this))
.value();
};
// Test if it's a valid plugin
Plugin.prototype.isValid = function() {
return (
this.packageInfos
&& this.packageInfos.name
&& this.packageInfos.engines
&& this.packageInfos.engines.gitbook
&& semver.satisfies(pkg.version, this.packageInfos.engines.gitbook)
);
};
// Resolve file path
Plugin.prototype.resolveFile = function(filename) {
return path.resolve(this.baseDir, filename);
};
// Resolve file path
Plugin.prototype.callHook = function(name, context, data) {
var hookFunc = this.infos.hooks? this.infos.hooks[name] : null;
data = data || {};
if (!hookFunc) return Q(data);
return Q()
.then(function() {
return hookFunc.apply(context, [data]);
});
};
// Has assets
Plugin.prototype.hasAssets = function(out) {
return (this.infos.book && this.infos.book.assets);
};
// Copy plugin assets fodler
Plugin.prototype.copyAssets = function(out) {
if (!this.hasAssets()) return Q();
return fs.copy(
this.resolveFile(this.infos.book.assets),
out
);
};
// Normalize a list of plugin name to use
Plugin.normalizeNames = function(names) {
// Normalize list to an array
names = _.isString(names) ? names.split(",") : (names || []);
// List plugins to remove
var toremove = _.chain(names)
.filter(function(name) {
return name.length > 0 && name[0] == "-";
})
.map(function(name) {
return name.slice(1)
})
.value();
// Merge with defaults
names = _.chain(names)
.concat(Plugin.defaults)
.uniq()
.value();
// Remove plugins starting with
names = _.filter(names, function(name) {
return !_.contains(toremove, name) && !(name.length > 0 && name[0] == "-");
});
return names;
};
// Extract data from a list of plugin
Plugin.fromList = function(names, root) {
var failed = [];
// Load plugins
var plugins = _.map(names, function(name) {
var plugin = new Plugin(name, root);
if (!plugin.isValid()) failed.push(name);
return plugin;
});
if (_.size(failed) > 0) return Q.reject(new Error("Error loading plugins: "+failed.join(",")));
// Get all resources
var resources = _.chain(RESOURCES)
.map(function(resource) {
return [
resource,
_.chain(plugins)
.map(function(plugin) {
return plugin.getResources(resource);
})
.flatten()
.value()
];
})
.object()
.value();
return Q({
'list': plugins,
'resources': resources,
'hook': function(name, context, data) {
return _.reduce(plugins, function(prev, plugin) {
return prev.then(function(ret) {
return plugin.callHook(name, context, ret);
})
}, Q(data));
},
'template': function(name) {
var withTpl = _.find(plugins, function(plugin) {
return (plugin.infos.templates
&& plugin.infos.templates[name]);
});
if (!withTpl) return null;
return withTpl.resolveFile(withTpl.infos.templates[name]);
}
});
};
// Default plugins
Plugin.defaults = [
"mixpanel",
"mathjax"
];
module.exports = Plugin;
-245
View File
@@ -1,245 +0,0 @@
var util = require("util");
var path = require("path");
var Q = require("q");
var _ = require("lodash");
var swig = require('swig');
var fs = require("../fs");
var parse = require("../../parse");
var BaseGenerator = require("../generator");
var indexer = require('./search_indexer');
var Manifest = require('../manifest');
// Swig filter for returning the count of lines in a code section
swig.setFilter('lines', function(content) {
return content.split('\n').length;
});
// Swig filter for returning a link to the associated html file of a markdown file
swig.setFilter('mdLink', function(link) {
var link = link.replace(".md", ".html");
if (link == "README.html") link = "index.html";
return link;
});
var Generator = function() {
BaseGenerator.apply(this, arguments);
// Attach methods to instance
_.bindAll(this);
this.revision = Date.now();
this.indexer = indexer();
this.manifest = new Manifest(Date.now());
this.manifest.add("NETWORK", [
'*'
]);
};
util.inherits(Generator, BaseGenerator);
// Load all templates
Generator.prototype.loadTemplates = function() {
this.template = swig.compileFile(
this.plugins.template("site") || path.resolve(this.options.theme, 'templates/site.html')
);
this.langsTemplate = swig.compileFile(
this.plugins.template("langs") || path.resolve(this.options.theme, 'templates/langs.html')
);
};
// Load plugins
Generator.prototype.loadPlugins = function() {
var that = this;
return BaseGenerator.prototype.loadPlugins.apply(this)
.then(function() {
return that.loadTemplates();
});
};
// Generate a template
Generator.prototype._writeTemplate = function(tpl, options, output, interpolate) {
var that = this;
interpolate = interpolate || _.identity;
return Q()
.then(function(sections) {
return tpl(_.extend({
revision: that.revision,
title: that.options.title,
description: that.options.description,
githubAuthor: that.options.github ? that.options.github.split("/")[0] : "",
githubId: that.options.github,
githubHost: that.options.githubHost,
summary: that.options.summary,
allNavigation: that.options.navigation,
plugins: that.plugins,
pluginsConfig: JSON.stringify(that.options.pluginsConfig),
options: that.options
}, options));
})
.then(interpolate)
.then(function(html) {
return fs.writeFile(
output,
html
);
});
};
Generator.prototype.indexPage = function(lexed, pagePath) {
this.indexer.add(lexed, pagePath);
return Q();
};
// Convert a markdown file to html
Generator.prototype.convertFile = function(content, _input) {
var that = this;
_output = _input.replace(".md", ".html");
if (_output == "README.html") _output = "index.html";
var input = path.join(this.options.input, _input);
var output = path.join(this.options.output, _output);
var basePath = path.relative(path.dirname(output), this.options.output) || ".";
var page = {
path: _input,
content: content,
progress: parse.progress(this.options.navigation, _input)
};
var _callHook = function(name) {
return that.callHook(name, page)
.then(function(_page) {
page = _page;
return page;
});
};
return Q()
.then(function() {
// Send content to plugins
return _callHook("page:before");
})
.then(function() {
// Lex page
return parse.lex(page.content);
})
.then(function(lexed) {
// Index page in search
return that.indexPage(lexed, _output)
.then(_.constant(lexed));
})
.then(function(lexed) {
// Get HTML generated sections
return parse.page(lexed, {
repo: that.options.githubId,
dir: path.dirname(_input) || '/',
outdir: path.dirname(_input) || '/',
});
})
.then(function(sections) {
page.sections = sections;
// Use plugin hook
return _callHook("page");
})
.then(function() {
that.manifest.add("CACHE", _output);
return that._writeTemplate(that.template, {
progress: page.progress,
_input: _input,
content: page.sections,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),
}, output, function(html) {
page.content = html;
return _callHook("page:after").get("content")
});
});
};
// Generate languages index
Generator.prototype.langsIndex = function(langs) {
var that = this;
var basePath = ".";
return this._writeTemplate(this.langsTemplate, {
langs: langs.list,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),
}, path.join(this.options.output, "index.html"))
.then(function() {
// Copy assets
return that.copyAssets();
});
};
// Copy assets
Generator.prototype.copyAssets = function() {
var that = this;
// Copy gitbook assets
return fs.copy(
path.join(that.options.theme, "assets"),
path.join(that.options.output, "gitbook")
)
// Add to cach manifest
.then(function() {
return that.manifest.addFolder(path.join(that.options.output, "gitbook"), "gitbook");
})
// Copy plugins assets
.then(function() {
return Q.all(
_.map(that.plugins.list, function(plugin) {
if (!plugin.hasAssets()) return Q();
var pluginAssets = path.join(that.options.output, "gitbook/plugins/", plugin.name);
return plugin.copyAssets(pluginAssets)
.then(function() {
return that.manifest.addFolder(pluginAssets, "gitbook/plugins/"+plugin.name);
});
})
);
})
};
// Dump search index to disk
Generator.prototype.writeSearchIndex = function() {
return fs.writeFile(
path.join(this.options.output, 'search_index.json'),
this.indexer.dump()
);
};
// Add cache manifest
Generator.prototype.writeCacheManifest = function() {
return fs.writeFile(
path.join(this.options.output, 'manifest.appcache'),
this.manifest.dump()
);
};
Generator.prototype.finish = function() {
return this.copyAssets()
.then(this.writeSearchIndex)
.then(this.writeCacheManifest);
};
module.exports = Generator;
-71
View File
@@ -1,71 +0,0 @@
var Q = require("q");
var _ = require("lodash");
var lunr = require('lunr');
var marked = require('marked');
var textRenderer = require('marked-text-renderer');
function Indexer() {
if(!(this instanceof Indexer)) {
return new Indexer();
}
_.bindAll(this);
// Setup lunr index
this.idx = lunr(function () {
this.ref('url');
this.field('title', { boost: 10 });
this.field('body');
});
this.renderer = textRenderer();
}
Indexer.prototype.text = function(nodes) {
// Copy section
var section = _.toArray(nodes);
// marked's Render expects this, we don't use it yet
section.links = {};
var options = _.extend({}, marked.defaults, {
renderer: this.renderer
});
return marked.parser(section, options);
};
Indexer.prototype.addSection = function(path, section) {
var url = [path, section.id].join('#');
var title = this.text(
_.filter(section, {'type': 'heading'})
);
var body = this.text(
_.omit(section, {'type': 'heading'})
);
// Add to lunr index
this.idx.add({
url: url,
title: title,
body: body,
});
};
Indexer.prototype.add = function(lexedPage, url) {
var sections = lexedPage;
_.map(sections, _.partial(this.addSection, url));
};
Indexer.prototype.dump = function() {
return JSON.stringify(this.idx);
};
// Exports
module.exports = Indexer;
-5
View File
@@ -1,5 +0,0 @@
module.exports = {
parse: require('./parse/'),
generate: require('./generate/')
};
-56
View File
@@ -1,56 +0,0 @@
var Q = require('q');
var _ = require('lodash');
var cp = require('child_process');
var url = require('url');
// Get the remote of a given repo
function gitURL(path) {
var d = Q.defer();
cp.exec("git config --get remote.origin.url", {
cwd: path,
env: process.env,
}, function(err, stdout, stderr) {
if(err) {
return d.reject(err);
}
return d.resolve(stdout);
});
return d.promise
.then(function(output) {
return output.replace(/(\r\n|\n|\r)/gm, "");
});
}
// Poorman's parsing
// Parse a git URL to a github ID : username/reponame
function githubID(_url) {
// Remove .git if it's in _url
var sliceEnd = _url.slice(-4) === '.git' ? -4 : _url.length;
// Detect HTTPS repos
var parsed = url.parse(_url);
if(parsed.protocol === 'https:' && parsed.host === 'github.com') {
return parsed.path.slice(1, sliceEnd);
}
// Detect SSH repos
if(_url.indexOf('git@') === 0) {
return _url.split(':', 2)[1].slice(0, sliceEnd);
}
// None found
return null;
}
function titleCase(str) {
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
}
module.exports = {
url: gitURL,
githubID: githubID,
titleCase: titleCase
};
-10
View File
@@ -1,10 +0,0 @@
module.exports = {
summary: require('./summary'),
langs: require('./langs'),
page: require('./page'),
lex: require('./lex'),
progress: require('./progress'),
navigation: require('./navigation'),
readme: require('./readme'),
git: require('./git')
};
-23
View File
@@ -1,23 +0,0 @@
var _ = require("lodash")
var parseSummary = require("./summary");
var parseLangs = function(content) {
var summary = parseSummary(content);
return {
list: _.chain(summary.chapters)
.filter(function(entry) {
return entry.path != null;
})
.map(function(entry) {
return {
title: entry.title,
path: entry.path,
lang: entry.path.replace("/", "")
};
})
.value()
}
};
module.exports = parseLangs;
-125
View File
@@ -1,125 +0,0 @@
var _ = require('lodash');
var marked = require('marked');
// Split a page up into sections (lesson, exercises, ...)
function splitSections(nodes) {
var section = [];
return _.reduce(nodes, function(sections, el) {
if(el.type === 'hr') {
sections.push(section);
section = [];
} else {
section.push(el);
}
return sections;
}, []).concat([section]); // Add remaining nodes
}
function isQuizNode(node) {
return (/^[(\[][ x][)\]]/).test(node.text || node);
}
function isExercise(nodes) {
var codeType = { type: 'code' };
// Number of code nodes in section
var len = _.filter(nodes, codeType).length;
return (
// Got 3 or 4 code blocks
(len === 3 || len === 4) &&
// Ensure all nodes are at the end
_.all(_.last(nodes, len), codeType)
);
}
function isQuiz(nodes) {
if (nodes.length < 3) {
return false;
}
// Support having a first paragraph block
// before our series of questions
var quizNodes = nodes.slice(nodes[0].type === 'paragraph' ? 1 : 0);
// No questions
if (!_.some(quizNodes, { type: 'blockquote_start' })) {
return false;
}
// Check if section has list of questions
// or table of questions
var listIdx = _.findIndex(quizNodes, { type: 'list_item_start' });
var tableIdx = _.findIndex(quizNodes, { type: 'table' });
if(
// List of questions
listIdx !== -1 && isQuizNode(quizNodes[listIdx + 1]) ||
// Table of questions
(
tableIdx !== -1 &&
_.every(quizNodes[tableIdx].cells[0].slice(1), isQuizNode)
)
) {
return true;
}
return false;
}
// What is the type of this section
function sectionType(nodes, idx) {
if(isExercise(nodes)) {
return 'exercise';
} else if(isQuiz(nodes)) {
return 'quiz';
}
return 'normal';
}
// Generate a uniqueId to identify this section in our code
function sectionId(section, idx) {
return _.uniqueId('gitbook_');
}
function lexPage(src) {
// Lex file
var nodes = marked.lexer(src);
return _.chain(splitSections(nodes))
.map(function(section, idx) {
// Detect section type
section.type = sectionType(section, idx);
return section;
})
.map(function(section, idx) {
// Give each section an ID
section.id = sectionId(section, idx);
return section;
})
.filter(function(section) {
return !_.isEmpty(section);
})
.reduce(function(sections, section) {
var last = _.last(sections);
// Merge normal sections together
if(last && last.type === section.type && last.type === 'normal') {
last.push.apply(last, [{'type': 'hr'}].concat(section));
} else {
// Add to list of sections
sections.push(section);
}
return sections;
}, [])
.value();
}
// Exports
module.exports = lexPage;
-70
View File
@@ -1,70 +0,0 @@
var _ = require('lodash');
// Cleans up an article/chapter object
// remove 'articles' attributes
function clean(obj) {
return obj && _.omit(obj, ['articles']);
}
function flattenChapters(chapters) {
return _.reduce(chapters, function(accu, chapter) {
return accu.concat([clean(chapter)].concat(chapter.articles));
}, []);
}
// Returns from a summary a map of
/*
{
"file/path.md": {
prev: ...,
next: ...,
},
...
}
*/
function navigation(summary, files) {
// Support single files as well as list
files = _.isArray(files) ? files : (_.isString(files) ? [files] : null);
// Special README nav
var README_NAV = {
path: 'README.md',
title: 'Introduction',
level: '0',
};
// List of all navNodes
var navNodes = [README_NAV].concat(flattenChapters(summary.chapters));
var prevNodes = [null].concat(navNodes.slice(0, -1));
var nextNodes = navNodes.slice(1).concat([null]);
// Mapping of prev/next for a give path
var mapping = _.chain(_.zip(navNodes, prevNodes, nextNodes))
.map(function(nodes) {
var current = nodes[0], prev = nodes[1], next = nodes[2];
// Skip if no path
if(!current.path) return null;
return [current.path, {
title: current.title,
prev: prev,
next: next,
level: current.level,
}];
})
.filter()
.object()
.value();
// Filter for only files we want
if(files) {
return _.pick(mapping, files);
}
return mapping;
}
// Exports
module.exports = navigation;
-156
View File
@@ -1,156 +0,0 @@
var _ = require('lodash');
var marked = require('marked');
var hljs = require('highlight.js');
var lex = require('./lex');
var renderer = require('./renderer');
var lnormalize = require('../utils/lang').normalize;
// Render a section using our custom renderer
function render(section, _options) {
// Copy section
section = _.toArray(section);
// marked's Render expects this, we don't use it yet
section.links = {};
// Build options using defaults and our custom renderer
var options = _.extend({}, marked.defaults, {
renderer: renderer(null, _options),
// Synchronous highlighting with highlight.js
highlight: function (code, lang) {
if(!lang) return code;
// Normalize lang
lang = lnormalize(lang);
try {
return hljs.highlight(lang, code).value;
} catch(e) { }
return code;
}
});
return marked.parser(section, options);
}
function quizQuestion(node) {
if (node.text) {
node.text = node.text.replace(/^([\[(])x([\])])/, "$1 $2");
} else {
return node.replace(/^([\[(])x([\])])/, "$1 $2");
}
}
function parsePage(src, options) {
options = options || {};
// Lex if not already lexed
return (_.isArray(src) ? src : lex(src))
.map(function(section) {
// Transform given type
if(section.type === 'exercise') {
var nonCodeNodes = _.reject(section, {
'type': 'code'
});
var codeNodes = _.filter(section, {
'type': 'code'
});
// Languages in code blocks
var langs = _.pluck(codeNodes, 'lang').map(lnormalize);
// Check that they are all the same
var validLangs = _.all(_.map(langs, function(lang) {
return lang && lang === langs[0];
}));
// Main language
var lang = validLangs ? langs[0] : null;
return {
id: section.id,
type: section.type,
content: render(nonCodeNodes),
lang: lang,
code: {
base: codeNodes[0].text,
solution: codeNodes[1].text,
validation: codeNodes[2].text,
// Context is optional
context: codeNodes[3] ? codeNodes[3].text : null,
}
};
} else if (section.type === 'quiz') {
var quiz = [], question, foundFeedback = false;
var nonQuizNodes = section[0].type === 'paragraph' && section[1].type !== 'list_start' ? [section[0]] : [];
var quizNodes = section.slice(0);
quizNodes.splice(0, nonQuizNodes.length);
for (var i = 0; i < quizNodes.length; i++) {
var node = quizNodes[i];
if (question && (((node.type === 'list_end' || node.type === 'blockquote_end') && i === quizNodes.length - 1)
|| node.type === 'table' || (node.type === 'paragraph' && !foundFeedback))) {
quiz.push({
base: render(question.questionNodes),
solution: render(question.solutionNodes),
feedback: render(question.feedbackNodes)
});
}
if (node.type === 'table' || (node.type === 'paragraph' && !foundFeedback)) {
question = { questionNodes: [], solutionNodes: [], feedbackNodes: [] };
}
if (node.type === 'blockquote_start') {
foundFeedback = true;
} else if (node.type === 'blockquote_end') {
foundFeedback = false;
}
if (node.type === 'table') {
question.solutionNodes.push(_.cloneDeep(node));
node.cells = node.cells.map(function(row) {
return row.map(quizQuestion);
});
question.questionNodes.push(node);
} else if (!/blockquote/.test(node.type)) {
if (foundFeedback) {
question.feedbackNodes.push(node);
} else if (node.type === 'paragraph' || node.type === 'text'){
question.solutionNodes.push(_.cloneDeep(node));
quizQuestion(node);
question.questionNodes.push(node);
} else {
question.solutionNodes.push(node);
question.questionNodes.push(node);
}
}
}
return {
id: section.id,
type: section.type,
content: render(nonQuizNodes),
quiz: quiz
};
}
// Render normal pages
return {
id: section.id,
type: section.type,
content: render(section, options)
};
});
}
// Exports
module.exports = parsePage;
-50
View File
@@ -1,50 +0,0 @@
var _ = require("lodash");
// Returns from a navigation and a current file, a snapshot of current detailed state
var calculProgress = function(navigation, current) {
var n = _.size(navigation);
var percent = 0, prevPercent = 0, currentChapter = null;
var done = true;
var chapters = _.chain(navigation)
.map(function(nav, path) {
nav.path = path;
return nav;
})
.sortBy(function(nav) {
return nav.level;
})
.map(function(nav, i) {
// Calcul percent
nav.percent = (i * 100) / Math.max((n - 1), 1);
// Is it done
nav.done = done;
if (nav.path == current) {
currentChapter = nav;
percent = nav.percent;
done = false;
} else if (done) {
prevPercent = nav.percent;
}
return nav;
})
.value();
return {
// Previous percent
prevPercent: prevPercent,
// Current percent
percent: percent,
// List of chapter with progress
chapters: chapters,
// Current chapter
current: currentChapter
};
}
module.exports = calculProgress;
-45
View File
@@ -1,45 +0,0 @@
var _ = require('lodash');
var marked = require('marked');
var textRenderer = require('marked-text-renderer');
function extractFirstNode(nodes, nType) {
return _.chain(nodes)
.filter(function(node) {
return node.type == nType;
})
.pluck("text")
.first()
.value();
}
function parseReadme(src) {
var nodes, title, description;
var renderer = textRenderer();
// Parse content
nodes = marked.lexer(src);
title = extractFirstNode(nodes, "heading") || '';
description = extractFirstNode(nodes, "paragraph") || '';
var convert = _.compose(
function(text) {
return _.unescape(text.replace(/(\r\n|\n|\r)/gm, ""));
},
function(text) {
return marked.parse(text, _.extend({}, marked.defaults, {
renderer: renderer
}));
}
);
return {
title: convert(title),
description: convert(description)
};
}
// Exports
module.exports = parseReadme;
-139
View File
@@ -1,139 +0,0 @@
var url = require('url');
var inherits = require('util').inherits;
var links = require('../utils').links;
var path = require('path');
var marked = require('marked');
var rendererId = 0;
function GitBookRenderer(options, extra_options) {
if(!(this instanceof GitBookRenderer)) {
return new GitBookRenderer(options, extra_options);
}
GitBookRenderer.super_.call(this, options);
this._extra_options = extra_options;
this.quizRowId = 0;
this.id = rendererId++;
this.quizIndex = 0;
}
inherits(GitBookRenderer, marked.Renderer);
GitBookRenderer.prototype._unsanitized = function(href) {
var prot = '';
try {
prot = decodeURIComponent(unescape(href))
.replace(/[^\w:]/g, '')
.toLowerCase();
} catch (e) {
return true;
}
if(prot.indexOf('javascript:') === 0) {
return true;
}
return false;
};
GitBookRenderer.prototype.link = function(href, title, text) {
// Our "fixed" href
var _href = href;
// Don't build if it looks malicious
if (this.options.sanitize && this._unsanitized(href)) {
return text;
}
// Parsed version of the url
var parsed = url.parse(href);
var o = this._extra_options;
// Relative link, rewrite it to point to github repo
if(links.isRelative(_href)) {
if (path.extname(_href) == ".md") {
_href = links.toAbsolute(_href, o.dir || "./", o.outdir || "./");
if (o.singleFile) {
_href = "#"+_href;
} else {
_href = _href.replace(".md", ".html");
}
} else if (o && o.repo && o.dir) {
href = url.resolve('https://github.com/' + o.repo + '/blob/', [o.dir, _href].join("/"));
parsed = url.parse(href);
_href = parsed.href;
}
}
// Generate HTML for link
var out = '<a href="' + _href + '"';
// Title if no null
if (title) {
out += ' title="' + title + '"';
}
// Target blank if external
if(parsed.protocol) {
out += ' target="_blank"';
}
out += '>' + text + '</a>';
return out;
};
GitBookRenderer.prototype.image = function(href, title, text) {
// Our "fixed" href
var _href = href;
// Parsed version of the url
var parsed = url.parse(href);
// Options
var o = this._extra_options;
// Relative image, rewrite it depending output
if(links.isRelative(href) && o && o.dir && o.outdir) {
// o.dir: directory parent of the file currently in rendering process
// o.outdir: directory parent from the html output
_href = links.toAbsolute(_href, o.dir, o.outdir);
}
return GitBookRenderer.super_.prototype.image.call(this, _href, title, text);
};
GitBookRenderer.prototype.tablerow = function(content) {
this.quizRowId += 1;
return GitBookRenderer.super_.prototype.tablerow(content);
};
var fieldRegex = /^([(\[])([ x])[\])]/;
GitBookRenderer.prototype._createCheckboxAndRadios = function(text) {
var match = fieldRegex.exec(text);
if (!match) {
return text;
}
var quizIdentifier = 'quiz-row-' + this.id + '-' + this.quizRowId + '-' + this.quizIndex++;
var field = "<input name='" + quizIdentifier + "' id='" + quizIdentifier + "' type='";
field += match[1] === '(' ? "radio" : "checkbox";
field += match[2] === 'x' ? "' checked/>" : "'/>";
var splittedText = text.split(fieldRegex);
var length = splittedText.length;
var label = '<label class="quiz-label" for="' + quizIdentifier + '">' + splittedText[length - 1] + '</label>';
return text.replace(fieldRegex, field).replace(splittedText[length - 1], label);
}
GitBookRenderer.prototype.tablecell = function(content, flags) {
return GitBookRenderer.super_.prototype.tablecell(this._createCheckboxAndRadios(content), flags);
};
GitBookRenderer.prototype.listitem = function(text) {
return GitBookRenderer.super_.prototype.listitem(this._createCheckboxAndRadios(text));
};
// Exports
module.exports = GitBookRenderer;
-117
View File
@@ -1,117 +0,0 @@
var _ = require('lodash');
var marked = require('marked');
// Utility function for splitting a list into groups
function splitBy(list, starter, ender) {
var starts = 0;
var ends = 0;
var group = [];
// Groups
return _.reduce(list, function(groups, value) {
// Ignore start and end delimiters in resulted groups
if(starter(value)) {
starts++;
} else if(ender(value)) {
ends++;
}
// Add current value to group
group.push(value);
// We've got a matching
if(starts === ends && starts !== 0) {
// Add group to end groups
// (remove starter and ender token)
groups.push(group.slice(1, -1));
// Reset group
group = [];
}
return groups;
}, []);
}
function listSplit(nodes, start_type, end_type) {
return splitBy(nodes, function(el) {
return el.type === start_type;
}, function(el) {
return el.type === end_type;
});
}
// Get the biggest list
// out of a list of marked nodes
function filterList(nodes) {
return _.chain(nodes)
.toArray()
.rest(function(el) {
// Get everything after list_start
return el.type !== 'list_start';
})
.reverse()
.rest(function(el) {
// Get everything after list_end (remember we're reversed)
return el.type !== 'list_end';
})
.reverse()
.value().slice(1, -1);
}
// Parses an Article or Chapter title
// supports extracting links
function parseTitle(src, nums) {
// Check if it's a link
var matches = marked.InlineLexer.rules.link.exec(src);
var level = nums.join('.');
// Not a link, return plain text
if(!matches) {
return {
title: src,
level: level,
path: null,
};
}
return {
title: matches[1],
level: level,
// Replace .md references with .html
path: matches[2].replace(/\\/g, '/'),
};
}
function parseArticle(chapterNum, nodes, idx) {
return parseTitle(_.first(nodes).text, [chapterNum, idx+1]);
}
function parseChapter(nodes, idx) {
return _.extend(parseTitle(_.first(nodes).text, [idx+1]), {
articles: _.map(listSplit(filterList(nodes), 'list_item_start', 'list_item_end'), parseArticle.bind(null, idx+1))
});
}
function parseSummary(src) {
var nodes = marked.lexer(src);
// Get out list of chapters
var chapterList = filterList(nodes);
// Split out chapter sections
var chapters = _.chain(listSplit(chapterList, 'list_item_start', 'list_item_end'))
.map(parseChapter)
.value();
return {
chapters: chapters
};
}
// Exports
module.exports = parseSummary;
-4
View File
@@ -1,4 +0,0 @@
module.exports = {
lang: require('./lang'),
links: require('./links')
};
-18
View File
@@ -1,18 +0,0 @@
var MAP = {
'py': 'python',
'js': 'javascript',
'rb': 'ruby',
};
function normalize(lang) {
if(!lang) { return null; }
var lower = lang.toLowerCase();
return MAP[lower] || lower;
}
// Exports
module.exports = {
normalize: normalize,
MAP: MAP
};
-29
View File
@@ -1,29 +0,0 @@
var url = require('url');
var path = require('path');
// Return true if the link is relative
var isRelative = function(href) {
var parsed = url.parse(href);
return !parsed.protocol && parsed.path && parsed.path[0] != '/';
};
// Relative to absolute path
// dir: directory parent of the file currently in rendering process
// outdir: directory parent from the html output
var toAbsolute = function(_href, dir, outdir) {
// Absolute file in source
_href = path.join(dir, _href);
// make it relative to output
_href = path.relative(outdir, _href);
return _href;
};
module.exports = {
isRelative: isRelative,
toAbsolute: toAbsolute
};
+39 -58
View File
@@ -1,66 +1,47 @@
{
"name": "gitbook",
"version": "0.4.5",
"homepage": "http://www.gitbook.io/",
"description": "Library and cmd utility to generate GitBooks",
"main": "lib/index.js",
"dependencies": {
"q": "1.0.1",
"lodash": "2.4.1",
"marked": "0.3.2",
"marked-text-renderer": "0.0.1",
"lunr": "0.5.2",
"swig": "1.3.2",
"send": "0.2.0",
"fstream-ignore": "0.0.7",
"commander": "2.2.0",
"fs-extra": "0.8.1",
"highlight.js": "8.0.0",
"tmp": "0.0.23",
"semver": "2.2.1",
"gaze": "~0.5.1",
"resolve": "0.6.3",
"gitbook-plugin": "0.0.2",
"gitbook-plugin-mixpanel": "0.0.2",
"gitbook-plugin-mathjax": "0.0.3"
},
"version": "0.1.0",
"devDependencies": {
"mocha": "1.18.2",
"grunt": "~0.4.2",
"grunt-cli": "0.1.11",
"grunt-contrib-less": "~0.5.0",
"grunt-contrib-requirejs": "0.4.1",
"grunt-bower-install-simple": "0.9.2"
"@biomejs/biome": "^1.9.4",
"@changesets/cli": "^2.29.7",
"turbo": "^2.5.8",
"vercel": "^39.4.2"
},
"packageManager": "bun@1.2.15",
"overrides": {
"@codemirror/state": "6.4.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"esbuild": "0.24.2"
},
"private": true,
"scripts": {
"test": "export TESTING=true; mocha --reporter list"
"dev": "turbo run dev --concurrency 20",
"build": "turbo run build",
"clean-deps": "rm -rf node_modules && rm -rf packages/*/node_modules",
"typecheck": "turbo run typecheck",
"format": "biome check --write ./",
"format:check": "biome check --diagnostic-level=error ./",
"unit": "turbo run unit",
"e2e": "turbo run e2e",
"e2e-customers": "turbo run e2e-customers",
"changeset": "changeset",
"changeset-version": "changeset version && bun run format && bun update",
"release": "turbo run release && bun run publish-all-packages",
"publish-all-packages": "for dir in packages/*; do (cd \"$dir\" && bun publish || true); done && changeset tag",
"download:env": "op read op://gitbook-x-dev/gitbook-open/.env.local >> .env.local",
"clean": "turbo run clean"
},
"bin": {
"gitbook": "./bin/gitbook.js"
},
"repository": {
"type": "git",
"url": "https://github.com/GitbookIO/gitbook.git"
},
"keywords": [
"git",
"book",
"gitbook"
],
"author": "FriendCode <contact@friendco.de>",
"license": "Apache 2",
"bugs": {
"url": "https://github.com/GitbookIO/gitbook/issues"
},
"contributors": [
{
"name": "Aaron O'Mullan",
"email": "aaron.omullan@gmail.com"
},
{
"name": "Samy Pessé",
"email": "samypesse@gmail.com"
"workspaces": {
"packages": ["packages/*"],
"catalog": {
"@gitbook/api": "0.143.2",
"bidc": "^0.0.2",
"tsdown": "^0.15.6"
}
]
},
"patchedDependencies": {
"decode-named-character-reference@1.0.2": "patches/decode-named-character-reference@1.0.2.patch",
"@vercel/next@4.4.2": "patches/@vercel%2Fnext@4.4.2.patch"
}
}
+1
View File
@@ -0,0 +1 @@
dist/
+13
View File
@@ -0,0 +1,13 @@
# @gitbook/browser-types
## 0.1.0
### Minor Changes
- cbc71a5: First version of the public package for typing script integrations.
### Patch Changes
- 854c448: Custom assistants followup
- Updated dependencies [25e2b40]
- @gitbook/icons@0.3.0
+3
View File
@@ -0,0 +1,3 @@
# `@gitbook/browser-types`
Typescript types for the global variables available in a GitBook website. These types can be used by integrations embedding scripts.
+24
View File
@@ -0,0 +1,24 @@
{
"name": "@gitbook/browser-types",
"description": "Typescript types for the global variables available in a GitBook website. These types can be used by integrations embedding scripts.",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"version": "0.1.0",
"dependencies": {
"@gitbook/api": "catalog:",
"@gitbook/icons": "workspace:"
},
"devDependencies": {
"typescript": "^5.5.3"
},
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit"
},
"files": ["dist", "README.md", "CHANGELOG.md"]
}
+84
View File
@@ -0,0 +1,84 @@
import type { AIToolCallResult, AIToolDefinition } from '@gitbook/api';
import type { IconName } from '@gitbook/icons';
export type GitBookIntegrationEvent = 'load' | 'unload';
export type GitBookIntegrationEventCallback = (...args: any[]) => void;
export type GitBookIntegrationTool = AIToolDefinition & {
/**
* Confirmation action to be displayed to the user before executing the tool.
*/
confirmation?: {
icon?: IconName;
label: string;
};
/**
* Callback when the tool is executed.
* The input is provided by the AI assistant following the input schema of the tool.
*/
execute: (input: object) => Promise<Pick<AIToolCallResult, 'output' | 'summary'>>;
};
export type GitBookAssistant = {
/**
* Name of the assistant displayed in the UI.
*/
label: string;
/**
* Icon of the assistant displayed in the UI.
* Any FontAwesome icon name is supported.
* @example 'sparkle'
*/
icon: string;
/**
* Callback when the assistant is opened.
*/
open: (query?: string) => void;
/**
* Whether to display the triggers for this assistant in the UI.
* @default true
*/
ui?: boolean;
};
export type GitBookGlobal = {
/**
* Register an event listener.
*/
addEventListener: (
type: GitBookIntegrationEvent,
func: GitBookIntegrationEventCallback
) => void;
/**
* Remove an event listener.
*/
removeEventListener: (
type: GitBookIntegrationEvent,
func: GitBookIntegrationEventCallback
) => void;
/**
* Register a custom tool to be exposed to the AI assistant.
*/
registerTool: (tool: GitBookIntegrationTool) => void;
/**
* Register a custom assistant to be available on the site.
*/
registerAssistant: (assistant: GitBookAssistant) => () => void;
};
declare global {
interface Window {
/**
* Global `window.GitBook` object accessible by integrations.
*/
GitBook?: GitBookGlobal;
}
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noEmit": false,
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"types": [
"bun-types" // add Bun global
]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}
+1
View File
@@ -0,0 +1 @@
dist/
+25
View File
@@ -0,0 +1,25 @@
# @gitbook/cache-tags
## 0.3.1
### Patch Changes
- 77397ca: Fix version of @gitbook/api referenced in package.json
## 0.3.0
### Minor Changes
- 116575c: Improve typing of getComputedContentSourceCacheTags to match latest API specification
## 0.2.0
### Minor Changes
- f32bf1f: Export function `getCacheTagForURL` to easily get the cache tag for a URL.
## 0.1.0
### Minor Changes
- 05ffd0e: Initial version of the package
+3
View File
@@ -0,0 +1,3 @@
# `@gitbook/cache-tags`
Utility to generate cache tags for GitBook Open.
+25
View File
@@ -0,0 +1,25 @@
{
"name": "@gitbook/cache-tags",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
}
},
"version": "0.3.1",
"dependencies": {
"@gitbook/api": "catalog:",
"assert-never": "^1.2.1"
},
"devDependencies": {
"typescript": "^5.5.3"
},
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit",
"dev": "tsc -w"
},
"files": ["dist", "src", "README.md", "CHANGELOG.md"]
}
+201
View File
@@ -0,0 +1,201 @@
import type { ComputedContentSource } from '@gitbook/api';
import assertNever from 'assert-never';
/**
* Get a stringified cache tag for a given object.
*/
export function getCacheTag(
spec: /**
* All data related to a user
* @deprecated - in v2, no tag as this is an immutable data
*/
| {
tag: 'user';
user: string;
}
/**
* All data related to a space
*/
| {
tag: 'space';
space: string;
}
/**
* All data related to an integration.
*/
| {
tag: 'integration';
integration: string;
}
/**
* All data related to a change request
*/
| {
tag: 'change-request';
space: string;
changeRequest: string;
}
/**
* Immutable data related to a revision
* @deprecated - in v2, no tag as this is an immutable data
*/
| {
tag: 'revision';
space: string;
revision: string;
}
/**
* Immutable data related to a document
* @deprecated - in v2, no tag as this is an immutable data
*/
| {
tag: 'document';
space: string;
document: string;
}
/**
* Immutable data related to a computed document
* @deprecated - in v2, no tag as this is an immutable data
*/
| {
tag: 'computed-document';
space: string;
sourceType: string;
}
/**
* All data related to the URL of a content
*/
| {
tag: 'url';
hostname: string;
}
/**
* All data related to a site
*/
| {
tag: 'site';
site: string;
}
/**
* All data related to an OpenAPI spec
*/
| {
tag: 'openapi';
organization: string;
openAPISpec: string;
}
/**
* All data related to a translation
*/
| {
tag: 'translation';
organization: string;
translation: string;
}
): string {
switch (spec.tag) {
case 'user':
return `user:${spec.user}`;
case 'url':
return `url:${spec.hostname}`;
case 'space':
return `space:${spec.space}`;
case 'change-request':
return `space:${spec.space}:change-request:${spec.changeRequest}`;
case 'revision':
return `space:${spec.space}:revision:${spec.revision}`;
case 'document':
return `space:${spec.space}:document:${spec.document}`;
case 'computed-document':
return `space:${spec.space}:computed-document:${spec.sourceType}`;
case 'site':
return `site:${spec.site}`;
case 'integration':
return `integration:${spec.integration}`;
case 'openapi':
return `organization:${spec.organization}:openapi:${spec.openAPISpec}`;
case 'translation':
return `organization:${spec.organization}:translation:${spec.translation}`;
default:
assertNever(spec);
}
}
/**
* Get the tags for a computed content source.
*/
export function getComputedContentSourceCacheTags(
inContext: {
spaceId: string;
organizationId: string;
},
source: ComputedContentSource
) {
const tags: string[] = [];
if (!('dependencies' in source)) {
return tags;
}
// We add the dependencies as tags, to ensure that the computed content is invalidated
// when the dependencies are updated.
const dependencies = Object.values(source.dependencies ?? {});
if (dependencies.length > 0) {
dependencies.forEach((dependency) => {
switch (dependency.ref.kind) {
case 'space':
tags.push(
getCacheTag({
tag: 'space',
space: dependency.ref.space,
})
);
break;
case 'openapi':
tags.push(
getCacheTag({
tag: 'openapi',
organization: inContext.organizationId,
openAPISpec: dependency.ref.spec,
})
);
break;
case 'translation':
tags.push(
getCacheTag({
tag: 'translation',
organization: inContext.organizationId,
translation: dependency.ref.translation,
})
);
break;
default:
// Do not throw for unknown dependency types
// as it might mean we are lagging behind the API version
break;
}
});
} else {
// Push a dummy tag, as the v1 is only using the first tag
tags.push(
getCacheTag({
tag: 'computed-document',
space: inContext.spaceId,
sourceType: source.type,
})
);
}
// We invalidate the computed content when a new version of the integration is deployed.
if (source.type.startsWith('integration:')) {
const integration = source.type.split(':')[1]!;
tags.push(
getCacheTag({
tag: 'integration',
integration,
})
);
}
return tags;
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noEmit": false,
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"types": [
"bun-types" // add Bun global
]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}
+1
View File
@@ -0,0 +1 @@
dist/
+43
View File
@@ -0,0 +1,43 @@
# @gitbook/colors
## 0.4.0
### Minor Changes
- 17dd382: Add `original` background color step
### Patch Changes
- 193d591: Fix return type for `colorContrast`
## 0.3.3
### Patch Changes
- c3f6b8c: Update chroma ratio per step
- 5e975ab: Fix code highlighting for HTTP
- f7a3470: Change lightness check for color step 9 to allow input colors with a higher-than-needed contrast
## 0.3.2
### Patch Changes
- cdffd7c: Desaturate text colors by decreasing chroma for the last steps of the color scale
## 0.3.1
### Patch Changes
- fb90eb0: Reduce chroma of first color scale step
## 0.3.0
### Minor Changes
- 4f0a772: Override tint lightness if supplied color is out of bounds
## 0.2.0
### Minor Changes
- 445baaa: Initial release
+3
View File
@@ -0,0 +1,3 @@
# `@gitbook/colors`
A set of default colors and transformation functions used throughout the GitBook Open and app.
+21
View File
@@ -0,0 +1,21 @@
{
"name": "@gitbook/colors",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"development": "./src/index.ts",
"default": "./dist/index.js"
}
},
"version": "0.4.0",
"devDependencies": {
"typescript": "^5.5.3"
},
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit",
"dev": "tsc -w"
},
"files": ["dist", "src", "README.md", "CHANGELOG.md"]
}
+39
View File
@@ -0,0 +1,39 @@
/**
* Default primary color throughout the GitBook ecosystem.
*/
export const DEFAULT_PRIMARY_COLOR = '#346DDB';
/**
* The darkest color that exists in GitBook, used as the relative minimum of every generated color scale.
*/
export const DARK_BASE = '#1D1D1D';
/**
* The lightest color that exists in GitBook, used as the relative maximum of every generated color scale.
*/
export const LIGHT_BASE = '#FFFFFF';
/**
* Used as the basis of all UI elements that are not colored by the primary color. Neutral gray by default, overridden by site customization.
*/
export const DEFAULT_TINT_COLOR = '#787878';
/**
* Used for informational messages and neutral alerts.
*/
export const DEFAULT_HINT_INFO_COLOR = '#787878';
/**
* Used for showing important information or non-critical warnings.
*/
export const DEFAULT_HINT_WARNING_COLOR = '#FE9A00';
/**
* Used for destructive actions or raising attention to critical information.
*/
export const DEFAULT_HINT_DANGER_COLOR = '#FB2C36';
/**
* Used for showing positive actions or achievements.
*/
export const DEFAULT_HINT_SUCCESS_COLOR = '#00C950';
+2
View File
@@ -0,0 +1,2 @@
export * from './colors';
export * from './transformations';
+445
View File
@@ -0,0 +1,445 @@
import { DARK_BASE, DEFAULT_TINT_COLOR, LIGHT_BASE } from './colors';
type ColorShades = {
[key: string]: string;
};
type RGBColor = [number, number, number];
type OKLABColor = { L: number; A: number; B: number };
type OKLCHColor = { L: number; C: number; H: number };
const D65 = [95.047, 100.0, 108.883] as const; // Reference white (D65)
export enum ColorCategory {
backgrounds = 'backgrounds',
components = 'components',
borders = 'borders',
accents = 'accents',
text = 'text',
}
type ColorSubScale = {
[key: string]: number | string;
};
/**
* Main color scale object.
*
* Each `ColorCategory` can be in/excluded in Tailwind's utility classes generation.
* Each subitem maps a semantic name within that category to a step in the scale.
*/
export const scale: Record<ColorCategory, ColorSubScale> = {
[ColorCategory.backgrounds]: {
/** Base background */
base: 1,
/** Accent background */
subtle: 2,
},
[ColorCategory.components]: {
/** Component background */
DEFAULT: 3,
/** Component hover background */
hover: 4,
/** Component active background */
active: 5,
},
[ColorCategory.borders]: {
/** Subtle borders, separators */
subtle: 6,
/** Element border, focus rings */
DEFAULT: 7,
/** Element hover border */
hover: 8,
},
[ColorCategory.accents]: {
/** Solid backgrounds */
solid: 9,
/** Hovered solid backgrounds */
'solid-hover': 10,
/** Original color */
original: 'original',
},
[ColorCategory.text]: {
/** Very low-contrast text
* Caution: this contrast does not meet accessiblity guidelines.
* Always check if you need to include a mitigating contrast-more style for users who need it. */
subtle: 9,
/** Low-contrast text */
DEFAULT: 11,
/** High-contrast text */
strong: 12,
},
};
/**
* The mix of foreground and background for every step in a colour scale.
* 0: 100% of the background color's luminosity, white in light mode
* 1: 100% of the foreground color's luminosity, black in light mode
*/
export const colorMixMapping = {
// bgs |components |borders |solid |text
light: [0, 0.02, 0.03, 0.05, 0.07, 0.1, 0.15, 0.2, 0.5, 0.55, 0.6, 1],
dark: [0, 0.03, 0.08, 0.1, 0.13, 0.15, 0.2, 0.25, 0.5, 0.55, 0.75, 1],
};
/**
* Convert a hex color to an RGB color.
*/
export function hexToRgb(hex: string): string {
const [r, g, b] = hexToRgbArray(hex);
// Return the RGB values separated by spaces
return `${r} ${g} ${b}`;
}
/**
* Convert a hex color to a RGBA color.
*/
export function hexToRgba(hex: string, alpha: number): string {
const [r, g, b] = hexToRgbArray(hex);
// Return the RGBA values separated by spaces
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
/**
* Generate Tailwind-compatible shades from a single color
* @param {string} hex The hex code to generate shades from
* @param {boolean} halfShades Generate additional shades, e.g. at 150
* @returns {{[key: number]: string}}
*/
export function shadesOfColor(hex: string, halfShades = false) {
const baseColor = hex;
const shades = [
50,
100,
200,
300,
400,
500,
600,
700,
800,
900,
...(halfShades ? [150, 250, 350, 450, 550, 650, 750, 850] : []),
].sort();
const result: ColorShades = {};
for (const shade of shades) {
const key = shade.toString();
if (shade === 500) {
result[key] = hex;
continue;
}
let shadeIndex = shade;
const isDarkShade = shadeIndex > 500;
if (isDarkShade) {
shadeIndex -= 500;
}
const percentage = shadeIndex / 500;
const startColor = isDarkShade ? DARK_BASE : baseColor;
const endColor = isDarkShade ? baseColor : LIGHT_BASE;
result[key] = getColor(percentage, hexToRgbArray(startColor), hexToRgbArray(endColor));
}
return result;
}
export type ColorScaleOptions = {
/** If set to `true`, inverts the scale (so 1 is black instead of white) and uses `colorMixMapping.dark` with different mix ratios per step. */
darkMode?: boolean;
/** Define a custom background color to use. If left undefined, the global `light`/`dark` values (in `colors.ts`) will be used. */
background?: string;
/** Define a custom foreground color to use. If left undefined, the global `light`/`dark` values (in `colors.ts`) will be used. */
foreground?: string;
mix?: {
/** If set to a hex code, this color will be additionally mixed into the generated scale according to `mix.ratio`. */
color: string;
/** Define a custom mix ratio to mix the `mix` color with. If left undefined, the default ratio will be used. */
ratio: number;
};
};
/**
* Generate a [Radix-like](https://www.radix-ui.com/colors/docs/palette-composition/understanding-the-scale) colour scale based of a hex colour.
* @param {string} hex The hex code to generate shades from
* @param {object} options
*/
export function colorScale(
hex: string,
{
darkMode = false,
background = darkMode ? DARK_BASE : LIGHT_BASE,
foreground = darkMode ? LIGHT_BASE : DARK_BASE,
mix,
}: ColorScaleOptions = {}
) {
const baseColor = rgbToOklch(hexToRgbArray(hex));
const mixColor = mix?.color ? rgbToOklch(hexToRgbArray(mix.color)) : null;
const foregroundColor = rgbToOklch(hexToRgbArray(foreground));
const backgroundColor = rgbToOklch(hexToRgbArray(background));
let mapping = darkMode ? colorMixMapping.dark : colorMixMapping.light;
if (mixColor && mix?.ratio && mix.ratio > 0) {
// If defined, we mix in a (tiny) bit of the mix color with the base color.
baseColor.L = mixColor.L * mix.ratio + baseColor.L * (1 - mix.ratio);
baseColor.C = mixColor.C * mix.ratio + baseColor.C * (1 - mix.ratio);
baseColor.H = mix.color === DEFAULT_TINT_COLOR ? baseColor.H : mixColor.H;
}
if (
(darkMode && baseColor.L < backgroundColor.L) ||
(!darkMode && baseColor.L > backgroundColor.L)
) {
// If the supplied color is outside of our lightness bounds, use the supplied color's lightness.
// This is mostly used to allow darker-than-dark backgrounds for brands that specifically want that look.
const difference = (backgroundColor.L - baseColor.L) / backgroundColor.L;
backgroundColor.L = baseColor.L;
// At the edges of the scale, the subtle lightness changes stop being perceptible. We need to amp up our mapping to still stand out.
const amplifier = 1;
mapping = mapping.map((step, index) =>
index < 9 ? step + step * amplifier * difference : step
);
}
const result = [];
for (let index = 0; index < mapping.length; index++) {
const step = mapping[index]!;
const targetL = foregroundColor.L * step + backgroundColor.L * (1 - step);
if (
index === 8 &&
!mix &&
(darkMode ? targetL - baseColor.L < 0.2 : baseColor.L - targetL < 0.2)
) {
// Original colour is close enough to target, so let's use the original colour as step 9.
result.push(hex);
continue;
}
const chromaRatio = (() => {
switch (index) {
// Step 9 and 10 have max chroma, meaning they are fully saturated.
case 8:
case 9:
return 1;
// Step 11 and 12 have a reduced chroma
case 10:
return 0.4;
case 11:
return 0.1;
default:
return index * 0.05;
}
})();
const shade = {
L: targetL, // Blend lightness
C: baseColor.C * chromaRatio,
H: baseColor.H, // Maintain the hue from the base color
};
const newHex = rgbArrayToHex(oklchToRgb(shade));
result.push(newHex);
}
return result;
}
/**
* Convert a hex color to an RGB color set.
*/
export function hexToRgbArray(hex: string): RGBColor {
const originalHex = hex;
let value = hex.replace('#', '');
if (hex.length === 3) value = value + value;
const r = value.substring(0, 2);
const g = value.substring(2, 4);
const b = value.substring(4, 6);
const rgb = [r, g, b].map((channel) => {
try {
const channelInt = Number.parseInt(channel, 16);
if (channelInt < 0 || channelInt > 255) throw new Error();
return channelInt;
} catch {
throw new Error(`Invalid hex color provided: ${originalHex}`);
}
});
return rgb as RGBColor;
}
/**
* Convert a RGB color set to a hex color.
*/
export function rgbArrayToHex(rgb: RGBColor): string {
return `#${rgb
.map((channel) => {
const component = channel.toString(16);
if (component.length === 1) return `0${component}`;
return component;
})
.join('')}`;
}
export function getColor(percentage: number, start: RGBColor, end: RGBColor) {
const rgb = end.map((channel, index) => {
return Math.round(channel + percentage * (start[index]! - channel));
});
return rgbArrayToHex(rgb as RGBColor);
}
// Utility constants and helper functions
export function rgbToLinear(rgb: RGBColor): [number, number, number] {
return rgb.map((v) => {
const scaled = v / 255;
return scaled <= 0.04045 ? scaled / 12.92 : ((scaled + 0.055) / 1.055) ** 2.4;
}) as [number, number, number];
}
export function linearToRgb(linear: [number, number, number]): RGBColor {
return linear.map((v) => {
const scaled = v <= 0.0031308 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055;
return Math.round(Math.max(0, Math.min(1, scaled)) * 255);
}) as RGBColor;
}
export function rgbToOklab(rgb: RGBColor): OKLABColor {
const [r, g, b] = rgbToLinear(rgb);
const l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
const m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
const s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
const lRoot = Math.cbrt(l);
const mRoot = Math.cbrt(m);
const sRoot = Math.cbrt(s);
return {
L: 0.2104542553 * lRoot + 0.793617785 * mRoot - 0.0040720468 * sRoot,
A: 1.9779984951 * lRoot - 2.428592205 * mRoot + 0.4505937099 * sRoot,
B: 0.0259040371 * lRoot + 0.7827717662 * mRoot - 0.808675766 * sRoot,
};
}
export function oklabToRgb(oklab: OKLABColor): RGBColor {
const { L, A, B } = oklab;
const lRoot = L + 0.3963377774 * A + 0.2158037573 * B;
const mRoot = L - 0.1055613458 * A - 0.0638541728 * B;
const sRoot = L - 0.0894841775 * A - 1.291485548 * B;
const l = lRoot ** 3;
const m = mRoot ** 3;
const s = sRoot ** 3;
const r = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
const g = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
const b = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
return linearToRgb([r, g, b]);
}
export function oklabToOklch(oklab: OKLABColor): OKLCHColor {
const { L, A, B } = oklab;
const C = Math.sqrt(A ** 2 + B ** 2);
const H = (Math.atan2(B, A) * 180) / Math.PI;
return { L, C, H: H < 0 ? H + 360 : H };
}
export function oklchToOklab(oklch: OKLCHColor): OKLABColor {
const { L, C, H } = oklch;
const rad = (H * Math.PI) / 180;
return {
L,
A: C * Math.cos(rad),
B: C * Math.sin(rad),
};
}
export function rgbToOklch(rgb: RGBColor): OKLCHColor {
return oklabToOklch(rgbToOklab(rgb));
}
export function oklchToRgb(oklch: OKLCHColor): RGBColor {
return oklabToRgb(oklchToOklab(oklch));
}
export function rgbToXyz(rgb: RGBColor): [number, number, number] {
const [r, g, b] = rgbToLinear(rgb);
return [
(r * 0.4124564 + g * 0.3575761 + b * 0.1804375) * 100,
(r * 0.2126729 + g * 0.7151522 + b * 0.072175) * 100,
(r * 0.0193339 + g * 0.119192 + b * 0.9503041) * 100,
];
}
export function xyzToLab65(xyz: [number, number, number]): {
L: number;
A: number;
B: number;
} {
const [x, y, z] = xyz.map((v, i) => {
const scaled = v / D65[i]!;
return scaled > 0.008856 ? Math.cbrt(scaled) : 7.787 * scaled + 16 / 116;
});
return {
L: 116 * y! - 16,
A: 500 * (x! - y!),
B: 200 * (y! - z!),
};
}
export function rgbTolab65(rgb: RGBColor): { L: number; A: number; B: number } {
return xyzToLab65(rgbToXyz(rgb));
}
/*
Delta Phi Star perceptual lightness contrast by Andrew Somers:
https://github.com/Myndex/deltaphistar
*/
export const PHI = 0.5 + Math.sqrt(1.25);
export function dpsContrast(a: RGBColor, b: RGBColor) {
const dps = Math.abs(rgbTolab65(a).L ** PHI - rgbTolab65(b).L ** PHI);
const contrast = dps ** (1 / PHI) * Math.SQRT2 - 40;
return contrast < 7.5 ? 0 : contrast;
}
export function colorContrast(
background: string,
foreground: string[] = [LIGHT_BASE, DARK_BASE]
): string {
const bg = hexToRgbArray(background);
const best: { color?: RGBColor; contrast: number } = {
color: undefined,
contrast: 0,
};
for (const color of foreground) {
const c = hexToRgbArray(color);
const contrast = dpsContrast(c, bg);
if (contrast > best.contrast) {
best.color = c;
best.contrast = contrast;
}
}
return best.color ? rgbArrayToHex(best.color) : foreground[0] || LIGHT_BASE;
}
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noEmit": false,
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"types": [
"bun-types" // add Bun global
]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}
+2
View File
@@ -0,0 +1,2 @@
dist/
standalone/
+25
View File
@@ -0,0 +1,25 @@
# @gitbook/embed
## 0.1.2
### Patch Changes
- 7508674: Fix bundling of packages
## 0.1.1
### Patch Changes
- 6f368b5: Fix embed assistant window width on small screens
## 0.1.0
### Minor Changes
- 81a6bd7: Improve API to control the GitBook embed
### Patch Changes
- 8927e8f: Initial version of the embed SDK.
- Updated dependencies [25e2b40]
- @gitbook/icons@0.3.0
+49
View File
@@ -0,0 +1,49 @@
# `@gitbook/embed`
Embed the GitBook Docs Assistant in your product or website.
# Usage
## As a script from your docs site
All GitBook docs site includes a script to easily embed the docs assistant as a widget on your website.
The script is served at `https://docs.company.com/~gitbook/embed/script.js`.
You can find the embed script from your docs site settings, or you can copy the following and replace the `docs.company.com` by your docs site hostname.
```html
<script src="https://docs.company.com/~gitbook/embed/script.js"></script>
<script>
window.GitBook('show');
</script>
```
## As a package from NPM
Install the package: `npm install @gitbook/embed` and import it in your web application:
```tsx
import { createGitBook } from '@gitbook/embed';
const gitbook = createGitBook({
siteURL: 'https://docs.company.com'
});
const iframe = document.createElement('iframe');
iframe.src = gitbook.getFrameURL();
const frame = gitbook.createFrame(iframe);
```
## As React components
After installing the NPM package, you can import prebuilt React components:
```tsx
import { GitBookProvider, GitBookAssistantFrame } from '@gitbook/embed/react';
<GitBookProvider siteURL="https://docs.company.com">
<GitBookAssistantFrame />
</GitBookProvider>
```
+37
View File
@@ -0,0 +1,37 @@
{
"name": "@gitbook/embed",
"description": "Embeddable components for GitBook",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./react": {
"types": "./dist/react/index.d.ts",
"default": "./dist/react/index.js"
}
},
"version": "0.1.2",
"dependencies": {
"@gitbook/api": "catalog:",
"@gitbook/icons": "workspace:",
"bidc": "catalog:"
},
"peerDependencies": {
"react": "^18.0.0"
},
"devDependencies": {
"tsdown": "catalog:",
"typescript": "^5.5.3",
"react": "^19.0.0"
},
"scripts": {
"build": "bun run build-lib && bun run build-standalone",
"build-lib": "tsdown",
"build-standalone": "bun build src/standalone/index.ts --bundle --minify --outdir=standalone",
"clean": "rm -rf ./dist",
"typecheck": "tsc --noEmit"
},
"files": ["dist", "README.md", "CHANGELOG.md"]
}
@@ -0,0 +1,61 @@
import { type GitBookFrameClient, createGitBookFrame } from './createGitBookFrame';
export type CreateGitBookOptions = {
/**
* URL of the GitBook site to embed.
*/
siteURL: string;
};
export type GetFrameURLOptions = {
/**
* Authentication to use for the frame.
*/
visitor?: {
/**
* Signed JWT token for Adaptive Content or Visitor Authentication to use.
*/
token?: string;
/**
* Unsigned claims to pass to the frame.
* You can use these claims in dynamic expressions using `visitor.claims.unsigned.<claim-name>`.
*/
unsignedClaims?: Record<string, unknown>;
};
};
export type GitBookClient = {
/**
* Get the URL for a GitBook frame.
*/
getFrameURL: (options: GetFrameURLOptions) => string;
/**
* Create a new GitBook frame.
*/
createFrame: (iframe: HTMLIFrameElement) => GitBookFrameClient;
};
export function createGitBook(options: CreateGitBookOptions) {
const client: GitBookClient = {
getFrameURL: (frameOptions) => {
const url = new URL(options.siteURL);
url.pathname = `${url.pathname.endsWith('/') ? url.pathname : `${url.pathname}/`}~gitbook/embed/assistant`;
if (frameOptions.visitor?.token) {
url.searchParams.set('token', frameOptions.visitor.token);
}
if (frameOptions.visitor?.unsignedClaims) {
Object.entries(frameOptions.visitor.unsignedClaims).forEach(([key, value]) => {
url.searchParams.set(`visitor.${key}`, String(value));
});
}
return url.toString();
},
createFrame: (iframe) => createGitBookFrame(iframe),
};
return client;
}
@@ -0,0 +1,98 @@
import { createChannel } from 'bidc';
import type {
FrameToParentMessage,
GitBookEmbeddableConfiguration,
ParentToFrameMessage,
} from './protocol';
export type GitBookFrameClient = {
/**
* Navigate to a page by its path.
*/
navigateToPage: (path: string) => void;
/**
* Navigate to the assistant.
*/
navigateToAssistant: () => void;
/**
* Post a message to the chat.
*/
postUserMessage: (message: string) => void;
/**
* Clear the chat.
*/
clearChat: () => void;
/**
* Set the placeholder settings.
*/
configure: (settings: Partial<GitBookEmbeddableConfiguration>) => void;
/**
* Register an event listener.
*/
on: (event: string, listener: (...args: any[]) => void) => () => void;
};
/**
* Create a client to communicate with the GitBook Assistant frame.
*/
export function createGitBookFrame(iframe: HTMLIFrameElement): GitBookFrameClient {
if (!iframe.contentWindow) {
throw new Error('Iframe must have a content window');
}
const channel = createChannel(iframe.contentWindow);
channel.receive((message: FrameToParentMessage) => {
console.log('[gitbook:embed] received message', message);
if (message.type === 'close') {
const listeners = events.get('close') || [];
if (listeners) {
listeners.forEach((listener) => listener());
}
}
});
const sendToFrame = (message: ParentToFrameMessage) => {
console.log('[gitbook:embed] send message', message);
channel.send(message);
};
const events = new Map<string, Array<(...args: any[]) => void>>();
const configuration: GitBookEmbeddableConfiguration = {
buttons: [],
welcomeMessage: '',
suggestions: [],
tools: [],
};
return {
navigateToPage: (pagePath) => {
sendToFrame({ type: 'navigateToPage', pagePath });
},
navigateToAssistant: () => {
sendToFrame({ type: 'navigateToAssistant' });
},
postUserMessage: (message) => sendToFrame({ type: 'postUserMessage', message }),
configure: (settings) => {
Object.assign(configuration, settings);
sendToFrame({ type: 'configure', settings: configuration });
},
clearChat: () => sendToFrame({ type: 'clearChat' }),
on: (event, listener) => {
const listeners = events.get(event) || [];
listeners.push(listener);
events.set(event, listeners);
return () => {
events.set(
event,
listeners.filter((l) => l !== listener)
);
};
},
};
}
+3
View File
@@ -0,0 +1,3 @@
export * from './createGitBook';
export * from './createGitBookFrame';
export * from './protocol';
+90
View File
@@ -0,0 +1,90 @@
import type { AIToolCallResult, AIToolDefinition } from '@gitbook/api';
import type { IconName } from '@gitbook/icons';
/**
* Custom tool definition to be passed to the AI assistant.
*/
export type GitBookToolDefinition = AIToolDefinition & {
/**
* Confirmation action to be displayed to the user before executing the tool.
*/
confirmation?: {
icon?: IconName;
label: string;
};
/**
* Callback when the tool is executed.
* The input is provided by the AI assistant following the input schema of the tool.
*/
execute: (input: object) => Promise<Pick<AIToolCallResult, 'output' | 'summary'>>;
};
/**
* Custom button definition to be passed to the embeddable GitBook.
*/
export type GitBookEmbeddableButtonDefinition = {
/**
* Icon to be displayed in the button.
*/
icon: IconName;
/**
* Label to be displayed in the button.
*/
label: string;
/**
* Callback when the button is clicked.
*/
onClick: () => void | Promise<void>;
};
/**
* Overall configuration for the layout of the embeddable GitBook.
*/
export type GitBookEmbeddableConfiguration = {
/**
* Buttons to be displayed in the header of the embeddable GitBook.
*/
buttons: GitBookEmbeddableButtonDefinition[];
/** Message to be displayed in the welcome page. */
welcomeMessage: string;
/** Suggestions of questions to be displayed in the welcome page. */
suggestions: string[];
/** Tools to be provided to the assistant. */
tools: GitBookToolDefinition[];
};
/**
* Messages sent from the parent to the frame.
*/
export type ParentToFrameMessage =
| {
type: 'postUserMessage';
message: string;
}
| {
type: 'clearChat';
}
| {
type: 'configure';
settings: GitBookEmbeddableConfiguration;
}
| {
type: 'navigateToPage';
pagePath: string;
}
| {
type: 'navigateToAssistant';
};
/**
* Messages sent from the frame to the parent.
*/
export type FrameToParentMessage = {
type: 'close';
};
+1
View File
@@ -0,0 +1 @@
export * from './client';
+51
View File
@@ -0,0 +1,51 @@
import React from 'react';
import type {
GetFrameURLOptions,
GitBookEmbeddableConfiguration,
GitBookFrameClient,
} from '../client';
import { useGitBook } from './GitBookProvider';
export type GitBookFrameProps = {
className?: string;
} & GetFrameURLOptions &
GitBookEmbeddableConfiguration;
/**
* Render a frame with the GitBook Assistant in it.
*/
export function GitBookFrame(props: GitBookFrameProps) {
const { className, visitor, buttons, welcomeMessage, suggestions, tools } = props;
const frameRef = React.useRef<HTMLIFrameElement>(null);
const gitbook = useGitBook();
const [gitbookFrame, setGitbookFrame] = React.useState<GitBookFrameClient | null>(null);
const frameURL = React.useMemo(() => gitbook.getFrameURL({ visitor }), [gitbook, visitor]);
React.useEffect(() => {
if (frameRef.current) {
setGitbookFrame(gitbook.createFrame(frameRef.current));
}
}, [gitbook]);
React.useEffect(() => {
gitbookFrame?.configure({
buttons,
welcomeMessage,
suggestions,
tools,
});
}, [gitbookFrame, buttons, welcomeMessage, suggestions, tools]);
return (
<iframe
title="GitBook"
ref={frameRef}
src={frameURL}
width="100%"
height="100%"
className={className}
/>
);
}
@@ -0,0 +1,36 @@
'use client';
import * as React from 'react';
import { type CreateGitBookOptions, createGitBook } from '../client';
import { GitBookContext } from './context';
/**
* Provider for the GitBook client.
*/
export function GitBookProvider(props: React.PropsWithChildren<CreateGitBookOptions>) {
const { siteURL, children } = props;
const options = React.useMemo(
() => ({
siteURL,
}),
[siteURL]
);
const client = React.useMemo(() => createGitBook(options), [options]);
return <GitBookContext.Provider value={client}>{children}</GitBookContext.Provider>;
}
/**
* Hook to access the GitBook client.
*/
export function useGitBook() {
const context = React.useContext(GitBookContext);
if (!context) {
throw new Error('This component must be used within a <GitBookProvider />');
}
return context;
}
+6
View File
@@ -0,0 +1,6 @@
'use client';
import * as React from 'react';
import type { GitBookClient } from '../client';
export const GitBookContext = React.createContext<GitBookClient | null>(null);
+2
View File
@@ -0,0 +1,2 @@
export * from './GitBookProvider';
export * from './GitBookFrame';
+178
View File
@@ -0,0 +1,178 @@
import './style.css';
import {
type CreateGitBookOptions,
type GetFrameURLOptions,
type GitBookClient,
type GitBookEmbeddableConfiguration,
type GitBookFrameClient,
createGitBook,
} from '../client';
export type GitBook = () => void;
type StandaloneCalls =
// Initialize the widget
| ['init', CreateGitBookOptions, GetFrameURLOptions]
// Unload the widget
| ['unload']
// Show the widget
| ['show']
// Hide the widget
| ['hide']
// Open the window
| ['open']
// Close the window
| ['close']
// Toggle the window
| ['toggle']
// Post a user message
| ['postUserMessage', string]
// Clear the chat
| ['clearChat']
// Configure the embed
| ['configure', Partial<GitBookEmbeddableConfiguration>]
// Navigate to a page
| ['navigateToPage', string]
// Navigate to the assistant
| ['navigateToAssistant'];
export type GitBookStandalone = ((...args: StandaloneCalls) => void) & {
q?: StandaloneCalls[];
};
const widgetButton = document.createElement('button');
widgetButton.id = 'gitbook-widget-button';
widgetButton.addEventListener('click', () => {
GitBook('toggle');
});
widgetButton.innerHTML = `
<span id="gitbook-widget-button-icon"></span>
<span id="gitbook-widget-button-label">Ask</span>
`;
const widgetWindow = document.createElement('div');
widgetWindow.id = 'gitbook-widget-window';
widgetWindow.classList.add('hidden');
document.body.appendChild(widgetButton);
document.body.appendChild(widgetWindow);
let widgetIframe: HTMLIFrameElement | undefined;
let _client: GitBookClient | undefined;
let _frame: GitBookFrameClient | undefined;
let frameOptions: GetFrameURLOptions | undefined;
let frameConfiguration: GitBookEmbeddableConfiguration = {
buttons: [],
welcomeMessage: '',
suggestions: [],
tools: [],
};
function getClient() {
if (!_client) {
throw new Error(
'GitBook client not initialized. Call GitBook("init", { siteURL: "..." }) first.'
);
}
return _client;
}
function getIframe() {
if (!widgetIframe || !_frame) {
const client = getClient();
widgetIframe?.remove();
widgetIframe = document.createElement('iframe');
widgetIframe.id = 'gitbook-widget-iframe';
widgetIframe.src = client.getFrameURL({
...frameOptions,
});
widgetWindow.appendChild(widgetIframe);
_frame = client.createFrame(widgetIframe);
}
return { iframe: widgetIframe, frame: _frame };
}
const GitBook = (...args: StandaloneCalls) => {
switch (args[0]) {
case 'init':
if (_client) {
throw new Error(
'GitBook client already initialized. Call GitBook("unload") first.'
);
}
_client = createGitBook(args[1]);
frameOptions = args[2];
break;
case 'unload':
_client = undefined;
_frame = undefined;
widgetIframe?.remove();
widgetWindow.classList.add('hidden');
break;
case 'show':
widgetButton.classList.remove('hidden');
break;
case 'hide':
widgetButton.classList.add('hidden');
break;
case 'open':
widgetWindow.classList.remove('hidden');
widgetButton.classList.add('open');
getIframe();
break;
case 'toggle':
widgetWindow.classList.toggle('hidden');
widgetButton.classList.toggle('open');
getIframe();
break;
case 'close':
widgetWindow.classList.add('hidden');
widgetButton.classList.remove('open');
break;
case 'postUserMessage':
getIframe().frame.postUserMessage(args[1]);
break;
case 'configure':
frameConfiguration = {
...frameConfiguration,
...args[1],
};
getIframe().frame.configure({
...frameConfiguration,
buttons: [
...frameConfiguration.buttons,
// Always include a close button
{
icon: 'close',
label: 'Close',
onClick: () => {
GitBook('close');
},
},
],
});
break;
case 'clearChat':
getIframe().frame.clearChat();
break;
case 'navigateToPage':
getIframe().frame.navigateToPage(args[1]);
break;
case 'navigateToAssistant':
getIframe().frame.navigateToAssistant();
break;
}
};
// @ts-expect-error - GitBook is not defined in the global scope
const precalls = (window.GitBook as GitBookStandalone | undefined)?.q ?? [];
// @ts-expect-error - GitBook is not defined in the global scope
window.GitBook = GitBook;
precalls.forEach((call) => GitBook(...call));
GitBook('configure', {});
+171
View File
@@ -0,0 +1,171 @@
:root {
--gitbook-widget-top: 1rem;
--gitbook-widget-bottom: 1rem;
--gitbook-widget-right: 1rem;
--gitbook-widget-left: 1rem;
--gitbook-widget-button-height: 46px;
--gitbook-widget-radius: .5rem;
--gitbook-widget-text-size: 1rem;
--gitbook-widget-text-color: #656973;
--gitbook-widget-border-color: #e5e5e5;
--gitbook-widget-background-translucent: rgba(255, 255, 255, 0.9);
--gitbook-widget-background-translucent-hover: rgba(250, 250, 250, 0.9);
--gitbook-widget-background-solid: #FFFFFF;
--gitbook-widget-background-solid-hover: #FBFBFB;
--gitbook-widget-icon-size: 1.25rem;
--gitbook-widget-window-width: 28rem; /* 448px */
--gitbook-widget-window-height: 40rem; /* 640px */
--gitbook-widget-window-spacing: .5rem; /* Spacing between the button and the window */
--gitbook-widget-window-bottom: calc(var(--gitbook-widget-bottom) + var(--gitbook-widget-button-height) + var(--gitbook-widget-window-spacing));
--gitbook-widget-transition-duration-fast: 0.2s;
--gitbook-widget-transition-duration-slow: 0.5s;
--gitbook-widget-easing: cubic-bezier(0.25, 1, 0.5, 1);
--gitbook-widget-easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}
* {
box-sizing: border-box;
}
/* Button */
#gitbook-widget-button {
position: fixed;
bottom: var(--gitbook-widget-bottom);
right: var(--gitbook-widget-right);
height: var(--gitbook-widget-button-height);
z-index: 9999;
display: flex;
align-items: center;
flex-direction: row-reverse;
gap: .5rem;
padding: .75rem 1rem;
border-radius: 100px;
border: 1px solid var(--gitbook-widget-border-color);
background-color: var(--gitbook-widget-background-translucent);
backdrop-filter: blur(16px);
font-size: var(--gitbook-widget-text-size);
color: var(--gitbook-widget-text-color);
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.05), 0 1px 2px -1px rgba(0,0,0,0.05);
transition: all var(--gitbook-widget-transition-duration-fast) var(--gitbook-widget-easing);
cursor:pointer;
animation: gitbook-widget-present var(--gitbook-widget-transition-duration-slow) var(--gitbook-widget-easing-bounce);
}
#gitbook-widget-button:hover, #gitbook-widget-button:focus-visible {
background-color: var(--gitbook-widget-background-translucent-hover);
}
#gitbook-widget-button:hover, #gitbook-widget-button:focus-visible {
transform: translateY(-1px);
box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}
#gitbook-widget-button:active {
transform: translateY(0);
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.05), 0 1px 2px -1px rgba(0,0,0,0.05);
}
@media (prefers-contrast: more) {
#gitbook-widget-button {
background-color: var(--gitbook-widget-background-solid);
}
#gitbook-widget-button:hover, #gitbook-widget-button:focus-visible {
background-color: var(--gitbook-widget-background-solid-hover);
}
}
#gitbook-widget-button.hidden {
display: none;
}
#gitbook-widget-button.open {
padding: .75rem;
gap: 0;
}
/* Button: Icon */
#gitbook-widget-button-icon {
width: var(--gitbook-widget-icon-size);
height: var(--gitbook-widget-icon-size);
mask-image: url("https://static-2v.gitbook.com/~gitbook/static/icons/svgs/custom-icons/gitbook-assistant.svg?v=2");
mask-size: contain;
mask-repeat: no-repeat;
mask-position: center;
background-color: currentColor;
}
#gitbook-widget-button.open #gitbook-widget-button-icon {
mask-image: url('https://ka-p.fontawesome.com/releases/v6.6.0/svgs/regular/close.svg?v=2&token=a463935e93');
}
/* Button: Label */
#gitbook-widget-button.open #gitbook-widget-button-label {
display: none;
}
/* Window */
#gitbook-widget-window {
position: fixed;
bottom: var(--gitbook-widget-window-bottom);
right: var(--gitbook-widget-right);
z-index: 9998;
width: calc(min(var(--gitbook-widget-window-width), calc(100vw - var(--gitbook-widget-right) - var(--gitbook-widget-left))));
height: calc(min(var(--gitbook-widget-window-height), calc(100vh - var(--gitbook-widget-window-bottom) - var(--gitbook-widget-top))));
background-color: var(--gitbook-widget-background-solid);
border: 1px solid var(--gitbook-widget-border-color);
border-radius: var(--gitbook-widget-radius);
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
overflow: hidden;
transition-property: transform, opacity, display;
transition-duration: var(--gitbook-widget-transition-duration-slow);
transition-timing-function: var(--gitbook-widget-easing-bounce);
transform-origin: bottom right;
transition-behavior: allow-discrete;
}
@starting-style {
#gitbook-widget-window {
opacity: 0;
transform: scale(0.9);
}
}
body:has(#gitbook-widget-button.hidden) #gitbook-widget-window {
bottom: var(--gitbook-widget-bottom);
}
#gitbook-widget-window.hidden {
transition-property: transform, opacity, display;
transition-duration: var(--gitbook-widget-transition-duration-fast);
transition-timing-function: var(--gitbook-widget-easing);
transition-behavior: allow-discrete;
display: none;
opacity: 0;
transform: scale(0.9);
}
#gitbook-widget-iframe {
width: 100%;
height: 100%;
border: none;
}
@keyframes gitbook-widget-present {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": false,
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"types": []
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules"]
}
+9
View File
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsdown';
export default defineConfig([
{
entry: ['src/index.ts', 'src/react/index.ts'],
dts: true,
format: ['esm'],
},
]);
+1
View File
@@ -0,0 +1 @@
dist/
+13
View File
@@ -0,0 +1,13 @@
# @gitbook/emoji-codepoints
## 0.2.0
### Minor Changes
- 57adb3e: Second release to fix publishing with changeset
## 0.1.0
### Minor Changes
- 5f8a8fe: Initial release
+27
View File
@@ -0,0 +1,27 @@
import fs from 'node:fs';
import path from 'node:path';
import emojisRaws from 'emoji-assets/emoji.json';
interface EmojiData {
code_points: {
base: string;
fully_qualified: string;
};
}
const emojis = emojisRaws as Record<string, EmojiData>;
const output: Record<string, string> = {};
Object.entries(emojis).forEach(([key, value]) => {
const emoji = value.code_points?.fully_qualified;
if (emoji && key !== emoji) {
output[key] = emoji;
} else if (!emoji) {
}
});
fs.mkdirSync(path.resolve(__dirname, 'dist'), { recursive: true });
fs.writeFileSync(
path.resolve(__dirname, 'dist/index.ts'),
`export const emojiCodepoints: Record<string, string> = ${JSON.stringify(output, null, 4)};`
);

Some files were not shown because too many files have changed in this diff Show More