* 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
* Cache getPublishedContentByUrl by tags
* Reduce amount of cases returned by getURLLookupAlternatives
* Optimize lookup even more for revisions / change-requests
* Fix basePath for revisions / crs
* 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>
* 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
* 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>
* 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
* 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>
* 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
* 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>
* 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>
* 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>
* 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
* 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
* 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>
* 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
* 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
* 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
* 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>
* 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
* 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>
* 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
* 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>
* 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
* 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>
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
- 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
- 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
* 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
* 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>
* 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
* 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
* 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
> _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
GitBook uses [Bun](https://bun.sh/) to run the project. Make sure you're using the specified version of `node` before running any of the development commands to ensure a smooth development experience.
You can easily do this by running the command `nvm use`.
To start your local version of GitBook, run the command `bun dev`.
#### 4. Preview your changes
When running the development server, published GitBook sites can be rendered through your local version at `http://localhost:3000/`.
For example, our published docs can be viewed using the local version by visiting `http://localhost:3000/docs.gitbook.com` 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://docs.gitbook.com/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.
GitBook is a command line tool (and Node.js library) for building beautiful books using GitHub/Git and Markdown. Here is an example: [Learn Javascript](https://www.gitbook.io/book/GitBookIO/javascript). You can publish book easily online using [gitbook.io](https://www.gitbook.io) and an [editor](https://github.com/GitbookIO/editor) is available for Windows, Mac and Linux. You can follow [@GitBookIO](https://twitter.com/GitBookIO) on Twitter. Complete documentation is available at [help.gitbook.io](http://help.gitbook.io/).
<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: >=18.x)
- Bun
### 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).
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.
### Other development commands
-`bun format`: format the code
-`bun lint`: lint the code
### 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, ebook, json
--config <config file> Configuration file to use, defaults to book.js or 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 loads 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:
```js
{
// Folders to use for output
// Caution: it overrides the value from the command line
// It's not advised this option in the book.json
"output":null,
// Generator to use for building
// Caution: it overrides the value from the command line
// It's not advised this option in the book.json
"generator":"site",
// Book title and description (defaults are extracted from the README)
"title":null,
"description":null,
// For ebook format, the extension to use for generation (default is detected from output extension)
// "epub", "pdf", "mobi"
// Caution: it overrides the value from the command line
// It's not advised this option in the book.json
"extension":null,
// GitHub information (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":1to4
}
},
// Links in template (null: default, false: remove, string: new value)
You can publish your books to our index by visiting [GitBook.io](http://www.gitbook.io)
## Output Formats
GitBook can generate your book in the following formats:
* **Static Website**: This is the default format. It generates a complete interactive static website that can be, for example, hosted on GitHub Pages.
* **eBook**: A complete eBook with exercise solutions at the end of the book. Generate this format using: ```gitbook ebook ./myrepo```. You need to have [ebook-convert](http://manual.calibre-ebook.com/cli/ebook-convert.html) installed. The output format could be **PDF**, **ePub** or **MOBI**.
* **Single Page**: The book will be stored in a single printable HTML page. This format is used for conversion to PDF or eBook. Generate this format using: ```gitbook build ./myrepo -f page```.
* **JSON**: This format is used for debugging or extracting metadata from a book. Generate this format using: ```gitbook build ./myrepo -f json```.
## Book Format
A book is a Git repository containing at least 2 files: `README.md` and `SUMMARY.md`.
#### README.md
Typically, this should be the introduction for your book. It will be automatically added to the final summary.
#### SUMMARY.md
The `SUMMARY.md` defines your book's structure. It should contain a list of chapters, linking to their respective pages.
Example:
```markdown
# Summary
This is the summary of my book.
* [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)
```
Files that are not included in `SUMMARY.md` will not be processed by `gitbook`.
#### 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:
```markdown
* [English](en/)
* [French](fr/)
* [Español](es/)
```
You can see a complete example with the [Learn Git](https://github.com/GitbookIO/git) book.
#### Glossary
Allows you to specify terms and their respective definitions to be displayed in the glossary. Based on those terms, `gitbook` will automatically build an index and highlight those terms in pages.
The `GLOSSARY.md` format is very simple :
```markdown
# term
Definition for this term
# Another term
With it's definition, this can contain bold text and all other kinds of inline markup ...
If you are GitBook staff, you'll need our NPM token in your local environment.
```
.env.local
#### Ignoring files & folders
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`).
Best practices for the `.gitignore` is to ignore build files from [**node.js**](https://github.com/github/gitignore/blob/master/Node.gitignore) (`node_modules`, ...) and build files from GitBook: `_book`, `*.epub`, `*.mobi` and `*.pdf`.
#### Cover
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 small version of the cover can also be set by creating a file: **/cover_small.jpg**.
#### 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.
##### Official plugins:
| Name | Description |
| ----- | ---- |
| [exercises](https://github.com/GitbookIO/plugin-exercises) | Add interactive exercises to your book. |
| [quizzes](https://github.com/GitbookIO/plugin-quizzes) | Add interactive quizzes to your book. |
| [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:
| Name | Description |
| ----- | ---- |
| [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 |
| [Piwik Open Analytics](https://github.com/emmanuel-keller/gitbook-plugin-piwik) | Piwik Open Analytics tracking for your book |
| [JSBin](https://github.com/jcouyang/gitbook-plugin-jsbin) | Embedded jsbin frame into your book |
#### Debugging
You can use the environment variable `DEBUG=true` to get better error messages (with stack trace). For example:
NPM_TOKEN_READONLY=xxx
```
$ export DEBUG=true
$ gitbook build ./
and then reinstall dependencies.
## Contributing
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.
### Types of contributions
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.
#### Translations
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.
#### Bugs
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.
## Deployment
> [!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.
This project allows you to self-host the rendering portion of your GitBook published content. Self-hosting has pros and cons.
On the pro side, you can customize the look and feel of your content, and better embed your documentation in your application.
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).
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).
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.