Configuration

All configurations are stored as JSON in a file named book.json.

You can paste your book.json at jsonlint.com to validate the JSON syntax.

All fields are optionals or default to some extracted values.

Fields

gitbook

  1. { "gitbook": "2.x.x" }

This option is used to detect which version of GitBook will be use to generate the book.
The format is a SEMVER condition.

title

  1. { "title": "My Awesome Book" }

This option defines the title of your book, by default this value is extracted from the README (first title).

On gitbook.com, this value is defined from the title entered on the platform.

description

  1. { "description": "This is such a great book!" }

This option defines the description of your book, by default this value is extracted from the README (first paragraph).

On gitbook.com, this value is defined from the description entered on the platform.

isbn

  1. { "isbn": "978-3-16-148410-0" }

This option defines the ISBN associated with your book

language

  1. { "language": "fr" }

This option defines the language of your book, by default value is en.

This option is used for internationalization and localization, it changes the text from the website.

On gitbook.com, this value is defined from the language detected in the content or specified in the settings.

direction

  1. { "direction": "rtl" }

This option is used to override the text direction from the language.
It is recommended to set the language field to a language with the correct text direction instead.

styles

This option is used to add custom css to your book.

Example:

  1. {
  2. "styles": {
  3. "website": "styles/website.css",
  4. "ebook": "styles/ebook.css",
  5. "pdf": "styles/pdf.css",
  6. "mobi": "styles/mobi.css",
  7. "epub": "styles/epub.css"
  8. }
  9. }

plugins

  1. { "plugins": ["mathjax"] }

The list of plugins being used by a book is defined in the book.json configuration.

pluginsConfig

  1. {
  2. "plugins": ["myplugin"],
  3. "pluginsConfig": {
  4. "myPlugin": {
  5. "message": "Hello World"
  6. }
  7. }
  8. }

This option contains all plugins specific configurations.

structure

This option is used to override files paths used by GitBook.

For example if you want to use INTRO.md instead of README.md:

  1. {
  2. "structure": {
  3. "readme": "INTRO.md"
  4. }
  5. }

Structure types are readme, langs, summary and glossary.

variables

  1. {
  2. "variables": {
  3. "myTest": "Hello World"
  4. }
  5. }

This option defines the variables values being used in templating.

pdf

PDF specific options allow customization of header, footer, etc

  1. {
  2. "pdf": {
  3. "headerTemplate": "Header of the PDF with _TITLE_",
  4. "footerTemplate": "Footer HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_."
  5. }
  6. }