CLI
Config file
The gem-book command will automatically search for the configuration file gem-book.cli.{js|json|mjs} from the current working directory and supports most command line options (combined command line options when provided), for example:
TIP
If using
jsonformat, you can add"$schema": "https://unpkg.com/gem-book/schema.json"to get type hints, if you usejsformat, you can use jsdoc to import the typeimport('gem-book/common/config').CliConfig.
Options
-t, --title <title>
Specify the document title, read from package.json by default or use the current working directory name.
-i, --icon <path>
Specify the icon path, you can use a full URL or a relative path based on the current working directory.
-o, --output <path>
Specify the output file directory, the default is dist; If it is json, it will be used as the output path of gem-book.json.
--github <url>
Specify the GitHub address and it will be rendered in the navigation bar. By default, it will be read from the package.json and local .git directory.
-b, --source-branch <branch>
Specify the branch of the document, and finally generate a link to GitHub, default is main.
--base <dir>
Specify the location of the current working directory in the project. By default, the repository.directory field of package.json will be read, which is useful in Monorepo projects.
Assume your project structure is like this:
You need to specify --base:
-d, --source-dir <dir>
Specify the location of the document directory in GitHub, and finally generate a link to GitHub.
--build
Output all front-end resources and <gem-book> configuration.
--home-mode
Display the README.md / index.md in the document root directory in the homepage layout of the website, and the document
--nav <title,link>
Specify the navigation bar link, for example:
--ga <id>
Add Google Analytics v4 support.
--template <path>
Specify the HTML template path, you can execute additional Javascript or other meta elements in the template.
--i18n
Specify whether the document directory supports
--ignored <string>
Ignore files, use anymatch, default is **/node_modules/**.
--plugin <name or path>
Load the plugin, you can add more than one. You can also provide custom plugin using URLs or relative paths.
--theme <name or path>
Use built-in themes or custom themes.
--footer <string>
Custom render footer content.
--display-rank
Display the value used for sorting in the url.
--site <url>
Specifying a URL will generate sitemap.xml, which is beneficial for crawlers that do not support ShadowDOM.
--json
Only output the configuration of <gem-book> in json format, default is gem-book.json.
--config <path>
Specify cli config file path.
--debug
Output debugging information: gem-book.json, stats.json, source-map.