命令行界面

Jupyter Book 提供了一个命令行界面,可以方便地构建图书和运行一些常用函数。这个页面包含了关于 CLI(command-line interface)可以做什么的信息。

本页面是 CLI 的完整参考。对于新手想开始与木星书 CLI,我们建议从 概述 开始。

注解

您也可以在命令行中使用 jb 来简写 jupyter-book。 例如:jupyter-book build mybook/ 等价于 jb build mybook/

请参阅下面的完整命令行参考资料

jupyter-book

Build and manage books with Jupyter.

jupyter-book [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

build

Convert your book's or page's content to HTML or a PDF.

jupyter-book build [OPTIONS] PATH_SOURCE

Options

--path-output <path_output>

Path to the output artifacts

--config <config>

Path to the YAML configuration file (default: PATH_SOURCE/_config.yml)

--toc <toc>

Path to the Table of Contents YAML file (default: PATH_SOURCE/_toc.yml)

-W, --warningiserror

Error on warnings.

-n, --nitpick

Run in nit-picky mode, to generates warnings for all missing references.

--keep-going

With -W, do not stop the build on the first warning, instead error on build completion

--all

Re-build all pages. The default is to only re-build pages that are new/changed since the last run.

--builder <builder>

Which builder to use.

Options

html | dirhtml | singlehtml | pdfhtml | latex | pdflatex | linkcheck | custom

--custom-builder <custom_builder>

Specify alternative builder provided by Sphinx, including text and epub. This can only be used with --builder=custom. Valid options listed at https://www.sphinx-doc.org/en/master/man/sphinx-build.html

-v, --verbose

increase verbosity (can be repeated)

-q, --quiet

-q means no sphinx status, -qq also turns off warnings

--individualpages

[pdflatex] Enable build of PDF files for each individual page

Arguments

PATH_SOURCE

Required argument

clean

Empty the _build directory except jupyter_cache. If the all option has been flagged, it will remove the entire _build. If html/latex option is flagged, it will remove the html/latex subdirectories.

jupyter-book clean [OPTIONS] PATH_BOOK

Options

-a, --all

Remove build directory.

--html

Remove html directory.

--latex

Remove latex directory.

Arguments

PATH_BOOK

Required argument

config

Inspect your _config.yml file.

jupyter-book config [OPTIONS] COMMAND [ARGS]...

sphinx

Generate a Sphinx conf.py representation of the build configuration.

jupyter-book config sphinx [OPTIONS] PATH_SOURCE

Options

--config <config>

Path to the YAML configuration file (default: PATH_SOURCE/_config.yml)

--toc <toc>

Path to the Table of Contents YAML file (default: PATH_SOURCE/_toc.yml)

Arguments

PATH_SOURCE

Required argument

create

Create a Jupyter Book template that you can customize.

jupyter-book create [OPTIONS] PATH_BOOK

Options

--cookiecutter

Use cookiecutter to interactively create a Jupyter Book template.

Arguments

PATH_BOOK

Required argument

myst

Manipulate MyST markdown files.

jupyter-book myst [OPTIONS] COMMAND [ARGS]...

init

Add Jupytext metadata for your markdown file(s), with optional Kernel name.

jupyter-book myst init [OPTIONS] [PATH]...

Options

--kernel <kernel>

The name of the Jupyter kernel to attach to this markdown file.

Arguments

PATH

Optional argument(s)