* 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/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.
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)'
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 2.5.0-beta.6
- Fix default style for pdf footer and header
- Correctly handle query in image urls
- Fix templating in imported content
- Use helvetica as default font for PDFs
## 2.5.0-beta.5
- Fix position of sidebar toggle button
- Update asciidoc parser to remove git dependency
## 2.5.0-beta.4
- Fix compatibility for some plugins (like `autocover`)
- Fix position of sidebar toggle button when glossary button is present
## 2.5.0-beta.3
- Fix installation of plugins when using a pre-release
## 2.5.0-beta.2
- Fix support for pre-releases
## 2.5.0-beta.1
- Font settings, sharing and search are externalized as default plugins
- Plugins can define a configuration schema in the manifest, this schema will be used to validate configuration during build
- New Node.js API for plugin: `book.formatString(type, content)`
- New client side API for website plugins: `gitbook.toolbar.createButton(opts)`
- Better header/footer for PDF, CSS wil be inlined to easily style the header/footer
- Cleaner table of contents for ebooks
- Support for RTL in ebook's table of contents
- Better colors for mobi (links and code blocks)
## 2.4.3
- Add ukrainian translation (`uk`)
- Add `book.json` configuration for maximum size of search index
- Improve reliability of summary parser
## 2.4.2
- Default plugins should not be installed by `gitbook install`
- Limit search index size to avoid crash during generation
- Fix code highlighting for html without language specified
- Fix warning message for gitbook version when building a multilingual book
## 2.4.1
- Fix disabling of default plugins, ex: `-highlight`
## 2.4.0
- Fix page being updated when user wants to open a link in a new tab
- Plugins can now replaced default code highlighter
- Add semantic information for screen readers (web version)
- Content references accept absolute paths, resolved to book folder
- Improve overall reliability
## 2.3.3
- Fix bug in SUMMARY parsing preventing multiple entries without filenames
## 2.3.2
- Fix blocks (like maths) in Asciidoc
- Fix error when checking gitbook version
## 2.3.1
- Fix black font color for ebooks (mobi, pdf and epub)
- Fix ISO code for korean language
- Fix korean translation
- Fix syntax highlighting for asciidoc
- Fix inline html escaping in markdown
- Add warning for file outside SUMMARY
- Force SUMMARY entries to be unique by filename
## 2.3.0
- Fix nunjucks issue with multiple `{% raw %}` blocks
- Fix crash when git conref failed
- Fix crash when failed to download remote image (better error message)
- Fix flicking effect when changing page (big UX improvement)
- Add Hebrew translation (`he`)
- Add utility method `book.config.get` for plugins
- Hooks `page:before` and `page` are no longer deprecated
- Remove webfonts to make website lighter
- Make glossary's order case insensitive
## 2.2.0
- Fix direction in code blocks (always LTR)
- Add options `chapterMark` and `pageBreaksBefore` for PDF
- Update code highlighting library
-`book.json` accessible as `config` in templating syntax
- Add Vietnamese translation (`vi`)
## 2.1.0
- Fix error in calcul of `levels` in table of contents, error introduced a few versions ago
- Add optional `styles/print.css` to replace `print.css` used in ebook
## 2.0.4
- Fix `{% raw %}`, got confused with "fake" variable declarations
- Fix title of language chooser
- Fix the X-UA-Compatible meta tag
- Move style sheets to the <head> section
## 2.0.3
- Fix `gitbook init` for SUMMARY with empty entries
- Fix escaping of code blocks in markdown
## 2.0.2
- Fix relative links in windows
- Improve watcher in serve command (switch to chokidar)
- Add Romanian translation (`ro`)
- Add Finish translation (`fi`)
- Add Japanese translation (`jp`)
- Add Korean translation (`kr`)
## 2.0.1
- Improve error logging (display file, line and column)
- Add back support for `options.originalInput`
- Don't process math in markdown parser (delegated to `mathjax` plugin)
- Fix some cases of code blocks escaping
- Fix i18n for introduction title in json format
- Fix reload when book configuration is updated
- Fix backslashes in url when building on windows
## 2.0.0
- Fix page title of introduction
- Ignore codeblocks when replacing glossary terms
- Improve Unit Tests
- Fix scrolling position in website when preparing page
## 2.0.0-beta.5
- Fix progress order in json format
## 2.0.0-beta.4
- Fix default generator for use programmatically
- Add option "author" for html meta tags
- Fix links normalization (content and hash)
## 2.0.0-beta.3
- Fix odd cases with code blocks escaping
## 2.0.0-beta.2
- Fix definition of entry point title using SUMMARY.md
## 2.0.0-beta.1
- Fix windows incompatibility
- Add support for rtl (enabled by default for `ar` and `fa`)
- Escape code blocks in markdown parser
- Add Persian/Farsi translation (`fa`)
- Add Arabic translation (`ar`)
- Add Bengali translation (`bn`)
- Provide generator name in template context
## 2.0.0-alpha.9
- Fix links in sidebar
- Fix normalization of html link (README to index)
- Fix html snippets escaping
## 2.0.0-alpha.8
- Improve locale detection for i18n
- Fix chapter name for Glossary in pdf
- Don't escape html in glossary items
- Fix generation of multilingual book as ebook
- Add "post" block attribute to post-process
## 2.0.0-alpha.7
- Fix display of glossary in ebook formats
- Add default footer and header to pdf
- Fix generation of json format compatible with 1.x.x
- Add Simplifiled Chinese and Traditional Chinese translations
## 2.0.0-alpha.6
- Add es and pt translations
- Fix replacement of glossary terms
## 2.0.0-alpha.5
- Fix copy of files/covers
- Add back `finish:before` hook
## 2.0.0-alpha.4
- Fix copy of cover for multilingal books
## 2.0.0-alpha.3
- Norwegian translation
- Load plugins from book in priority
## 2.0.0-alpha.3
- Fix init command
- Update parsers to fix spaces in summary (`gitbook-parsers@0.3.1`)
## 2.0.0-alpha.1
- Externalize parsing into `gitbook-parsers` module
- Supports AsciiDoc and reStructuredText
- Hooks for page (`page:*`) are now deprecated, plugins should extend filters and blocks instead
- Hooks `summary` and `glossary` (after and before) have been removed
- Exercises and Quizzes are no longer parsed in the markdown parser
- Support for more markdown extensions: `.markdown`, `.mdown`
- Templates are rendered with nunjucks instead of swig, syntax is almost compatible, there is some changes with contexts and filters. `{{ super() }}` should be use instead of `{% parent %}`
- Clean output folder on build without removing `.git` and `.svn`
- MathJAX is no longer a default plugin
- SVG images are converted to PNG during generation of ebooks
- i18n in website and ebook (ru, it, de, fr)
- New templating syntax
- Content references (both internal and external)
- Glossary terms are handled during generation (also in ebook format)
## 1.5.0
- Fix `serve` command, broken by `1.4.2`
- Add nicer `dark` theme :)
## 1.4.2
- Force `process.exit` after builds, to prevent (possibly) lingering plugins
## 1.4.1
- Fix command 'install' without arguments
## 1.4.0
- Add command `gitbook install` to install plugins from book.json
-`package.json` is no longer necessary
## 1.3.4
- Add glossary to ebooks
- Fix autocover with new hook "finish:before"
- Add X-UA-Compatible meta tag for IE
## 1.3.3
- Fix parsing of lexed content using the client library
## 1.3.2
- ePub files are now passing validation from epubcheck
- Fix replacement of multiple glossary terms in a single sentence
- Fix on windows deep relative links
- Fix search indexer
## 1.3.1
- Fix error with links in markdown
## 1.3.0
- Bundle gitbook parsing library as a client side library in `gitbook.js` and `gitbook.min.js`
## 1.2.0
- Improvements on ebook generation
- Fix incorrect follow of links in ebook generation
- Move Table of Contents at the beginning of the ebook
- Update to last highlight.js (includes Swift)
- Includes of templates and variables (from book.json)
## 1.1.1
- Rewrite quiz logic to be more robust
- Improve integration of glossary
- Improve generation of ebook by using a multiple HTML pages input source
- Fix incorrect page breaks after h1 and h2 divs
- New options to set header and footer in PDF generation
## 1.1.0
- Plugins can now extend the ebook generation (pdf, epub, mobi)
- Update `kramed` to version 0.4.3
## 1.0.3
- Update `mathjax` plugin and MathJAx to version 2.4
- Update `highlight.js` to 8.2.0
## 1.0.2
- Update `mathjax` plugin, fixes issues with inline math rendering (no longer wanted)
## 1.0.1
- New inline math convention (kramdown's), using `$$` rather than `$` as delimiters
- Fix instapaper sharing
- The `exercises` & `quizzes` plugins are now by default
## 1.0.0
- New design
- Support for glossary
- Support for sharing to instapaper
- Support for footnotes
## 0.7.1
- Update `fs-extra` to `0.10.0` (fixes potential race conditions)
## 0.7.0
- Add page break in ebook (pdf, epub, mobi) between chapters/articles
- Start using kramed instead of marked
- Fix display of inline math
- Switch to graceful-fs to fix EMFILE errors
- Add sharing to weibo.com
## 0.6.2
- Support generating a plugin's book info dynamically
- Improve navigation on dark theme
- Improve path normalization when parsing SUMMARY.md
GitBook is a command line tool (and Node.js library) for building beautiful books using GitHub/Git and Markdown (or AsciiDoc). Here is an example: [Learn Javascript](https://www.gitbook.com/book/GitBookIO/javascript).
You can publish and host book easily online using [gitbook.com](https://www.gitbook.com), a desktop editor is [also available](https://www.gitbook.com/editor).
<p align="center">Welcome to GitBook, the platform for managing technical knowledge for teams.</p>
Check out the [GitBook Community Slack Channel](https://slack.gitbook.com), Stay updated by following [@GitBookIO](https://twitter.com/GitBookIO) on Twitter or [GitBook](https://www.facebook.com/gitbookcom) on Facebook.
<p align="center">This repository contains the open source code used to render GitBook's published content.</p>
Complete documentation is available at [help.gitbook.com](http://help.gitbook.com/).
<p align="center">
<img alt="GitBook Open Published Site" src="./assets/published-site.png">
- [Types of contributions](#types-of-contributions)
- [Licensing](#license)
- [Acknowledgements](#acknowledgements)
- [Legacy GitBook](#legacy-gitbook-deprecated)
GitBook can be installed from **NPM** using:
## 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 (Version: >=1.2.1)
- We use a text-based lockfile which isn't supported below 1.2.1
### 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).
GitBook can generate your book in the following formats:
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.
* **Static Website**: This is the default format. It generates a complete interactive static website that can be, for example, hosted on GitHub Pages.
* **eBook**: You need to have [ebook-convert](http://manual.calibre-ebook.com/cli/ebook-convert.html) installed. You can specify the eBook filename as the second argument, otherwise `book` will be used.
* Generate a **PDF** using: `gitbook pdf ./myrepo ./mybook.pdf`
* Generate a **ePub** using: `gitbook epub ./myrepo ./mybook.epub`
* Generate a **MOBI** using: `gitbook mobi ./myrepo ./mybook.mobi`
* **JSON**: This format is used for debugging or extracting metadata from a book. Generate this format using: ```gitbook build ./myrepo --format=json```.
### Other development commands
## Book Format
-`bun format`: format the code
-`bun lint`: lint the code
A book is a Git repository containing at least 2 files: `README.md` and `SUMMARY.md`.
### CI and testing
#### README.md
All pull-requests will be tested against both visual and performances testing to prevent regressions.
Typically, this should be the introduction for your book. It will be automatically added to the final summary.
## Fonts and Icons
#### 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 ...
```
#### Variables and Templating
A set of variables can be defined in the `book.json`:
```js
{
"variables":{
"host":"mybook.com"
}
}
```
These variables can be used in the markdown files:
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:
```
The host is {{ book.host }}
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.
```
You can also use condition with these variables:
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.
If you are GitBook staff, you'll need our NPM token in your local environment.
```
{% if book.host == "mybook.com" %}
.env.local
{% else %}
{% endif %}
NPM_TOKEN_READONLY=xxx
```
Variables of `book.json` are available in the `book` namespace. You can also access informations about the `file` itself and the `gitbook` version:
and then reinstall dependencies.
```
My file is {{ file.path }}
Modified at {{ file.mtime }}
Book built with GitBook {{ gitbook.version }}
## 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).
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`).
## Legacy GitBook (Deprecated)
Best practices for the `.gitignore` is to ignore build files from **node.js** (`node_modules`, ...) and build files from GitBook: `_book`, `*.epub`, `*.mobi` and `*.pdf` ([Download GitBook.gitignore](https://github.com/github/gitignore/blob/master/GitBook.gitignore)).
#### 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**.
#### AsciiDoc
Since version 2.0.0, AsciiDoc can be used instead of Markdown, simply replace the `.md` by the `.adoc` extension. Chapters in the summary are detected from an ordered list in the `SUMMARY.adoc`.
## Publish your book
The platform [GitBook.com](https://www.gitbook.com/) 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 be 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.
Plugins needed to build a book can be installed using: `gitbook install ./`. You can find plugins at [plugins.gitbook.com](http://plugins.gitbook.com).
## Debugging
You can use the options `--log=debug` and `--debug` to get better error messages (with stack trace). For example:
```
$ gitbook build ./ -- log=debug --debug
```
#### How to use the latest commit from GitBook in gitbook-cli
To use the latest commit from `GitBook/gitbook` with `gitbook-cli`:
Now `gitbook-cli` will be using the `./gitbook` folder.
You can uninstall it using: `gitbook versions:uninstall latest`.
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).
if(_.size(that.plugins.failed)>0)returnQ.reject(newError('Error loading plugins: '+that.plugins.failed.join(',')+'. Run \'gitbook install\' to install plugins from NPM.'));
that.book.log.warn.ln('gitbook version specified in your book.json might be too strict for future patches, \''+(_.first(pkg.version.split('.'))+'.x.x')+'\' is more adequate');
if(!_.contains(Plugin.HOOKS,name))this.book.log.warn.ln('hook "'+name+'" used by plugin "'+this.name+'" is deprecated, and will be removed in the coming versions');
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.