sphinx-build¶
概要¶
sphinx-build [options] <sourcedir> <outputdir> [filenames ...]
説明¶
sphinx-build generates documentation from the files in
<sourcedir>
and places it in the <outputdir>
.
sphinx-build は設定を <sourcedir>/conf.py
から探します。 sphinx-quickstart(1) は conf.py
を含む、生成されたテンプレートファイルに使われます。
sphinx-build can create documentation in different formats. A
format is selected by specifying the builder name on the command line; it
defaults to HTML. Builders can also perform other tasks related to
documentation processing. For a list of available builders, refer to
sphinx-build -b
.
デフォルトでは更新されたファイルだけがビルドされます。個々のファイルを指定すると、その選択されたファイルだけが出力されます。
オプション¶
- -b buildername¶
ビルダーを選択する、もっとも重要なオプションです。一般的に使用されるビルダーには次のような物があります。
- html
HTMLページをビルドします。デフォルトのビルダーです。
- dirhtml
HTMLページをビルドしますが、ドキュメントごとにディレクトリが生成されます。ウェブサーバで提供する場合に、
.html
がURLに付かないようにして、URLが分かりやすくなります。- singlehtml
すべてのコンテンツが含まれる、単一のHTMLを生成します。
- htmlhelp, qthelp, devhelp, epub
フォーマットごとに、ドキュメントのコレクションを構築するのに必要な情報と一緒に、HTMLファイルにビルドします。
- applehelp
Apple Help Bookを生成します。オープンソースではありませんが、Mac OS X 10.6以降でのみ使用できる hiutil と codesign が必要になります。
- latex
pdflatex を使用して、PDFドキュメントにコンパイルできるような、LaTeXのソースにビルドします。
- man
UNIX系システムで利用される、groffフォーマットのmanページをビルドします。
- texinfo
makeinfo を使ってInfoファイルを生成するための、Texinfoファイルにビルドします。
- text
プレーンテキストファイルをビルドします。
- gettext
gettextスタイルのメッセージカタログ(
.pot
ファイル)にビルドします。- doctest
もしも
doctest
拡張が有効になっている場合には、ドキュメント内のすべてのdoctestを実行します。- linkcheck
すべての外部リンク先が存在しているか確認をします。
- xml
Docutilsが生成するXMLファイルをそのまま出力します。
- pseudoxml
コンパクトな整形された"pseudo-XML"を出力します。これは中間ドキュメントツリーの内部構造です。
See Builders for a list of all builders shipped with Sphinx. Extensions can add their own builders.
- -M buildername¶
Alternative to
-b
. Uses the Sphinx make_mode module, which provides the same build functionality as a default Makefile or Make.bat. In addition to all Sphinx Builders, the following build pipelines are available:- latexpdf
Build LaTeX files and run them through pdflatex, or as per
latex_engine
setting. Iflanguage
is set to'ja'
, will use automatically the platex/dvipdfmx latex to PDF pipeline.- info
Build Texinfo files and run them through makeinfo.
重要
Sphinx only recognizes the
-M
option if it is placed first.バージョン 1.2.1 で追加.
- -a¶
If given, always write all output files. The default is to only write output files for new and changed source files. (This may not apply to all builders.)
- -E¶
保存されている 環境 を使用しないで、完全に再構築する場合に利用します。環境にはクロスリファレンスの構造を保持しています。デフォルトでは新規に作成されたり、最後に実行してから変更のあったソースファイルだけを読み込んで、パースします。
- -d path¶
Sphinxは出力ファイルが書き込むことが可能になる前に、すべてのソースファイルを読み込むため、パースされたソースファイルは "doctree pickles"と呼ばれるディレクトリにキャッシュされます。通常は、これらのファイルはビルドディレクトリの下の
.doctrees
と呼ばれるディレクトリに置かれます。このオプションを指定すると、キャッシュディレクトリを違う場所に設定できます。doctreeはすべてのビルダーで共有されます。
- -j N¶
Distribute the build over N processes in parallel, to make building on multiprocessor machines more effective. Note that not all parts and not all builders of Sphinx can be parallelized. If
auto
argument is given, Sphinx uses the number of CPUs as N.バージョン 1.2 で追加: このオプションが 実験的 な機能であることに注意して下さい。
バージョン 1.7 で変更: Support
auto
argument.
- -c path¶
ソースディレクトリ以下の
conf.py
ではなく、オプションで指定されたコンフィグレーションディレクトリ以下の設定ファイルを利用するようにします。ただし、さまざまな他のファイル、パスなど、設定値で与えられたものに関しては、コンフィグレーションディレクトリからの相対パスで探索されることになるため、その状況になってもファイルがきちんと読めるようにしておく必要があります。バージョン 0.3 で追加.
- -C¶
コンフィグファイルを無視します。設定は
-D
オプションを使って指定します。バージョン 0.5 で追加.
- -D setting=value¶
conf.py
ファイルで設定されたコンフィグを上書きします。この値は数値、文字列、リスト、もしくはディクショナリ型である必要があります。リストについては、コンマ区切りで次のように要素を分けることができます:
-D html_theme_path=path1,path2
.ディクショナリ型の値については、名前とキーを次のように与えます:
-D latex_elements.docclass=scrartcl
.boolean型の値には、
0
もしくは1
を使って下さい。バージョン 0.6 で変更: 値に辞書型を指定出来るようになりました。
バージョン 1.3 で変更: 値にリスト型を指定出来るようになりました。
- -A name=value¶
HTMLテンプレートの中の name を value に設定します。
バージョン 0.5 で追加.
- -n¶
エラーチェックが厳格なモードで実行されます。現在では、すべての見つからない参照に対して警告を生成するような実装になっています。
nitpick_ignore
は警告する必要の無いものを除外する設定です。
- -N¶
カラー出力をしません。
- -q¶
標準出力に何も出力しないようになります。警告やエラーのみが標準エラー出力に書き出されます。
- -Q¶
標準出力に何も出力しないようになります。警告も抑制されます。エラーのみが標準エラー出力に書き出されます。
- -w file¶
警告とエラーを指定されたファイルに書き出されます。なお、標準エラー出力にも同時に出力されます。
- -W¶
警告をエラーにします。最初の警告でビルドが中断され、
sphinx-build
が終了値1を返すようになります。
- --keep-going¶
With -W option, keep going processing when getting warnings to the end of build, and
sphinx-build
exits with exit status 1.バージョン 1.8 で追加.
- -T¶
捕捉されない例外が発生した時、完全なトレースバックを表示します。このオプションがない場合、要約だけが表示され、トレースバックの情報は今後の解析のためにファイルとして保存されます。
バージョン 1.2 で追加.
- -h, --help, --version¶
簡単な使い方やSphinxのバージョンを表示します。
バージョン 1.2 で追加.
You can also give one or more filenames on the command line after the source and build directories. Sphinx will then try to build only these output files (and their dependencies).
Environment Variables¶
The sphinx-build refers following environment variables:
- MAKE
A path to make command. A command name is also allowed. sphinx-build uses it to invoke sub-build process on make-mode.
Makefile Options
sphinx-quickstart によって作成された Makefile
と make.bat
は通常、 sphinx-build を -b
および -d
オプションだけで実行します。しかし、次のような変数を設定することで、動作をカスタマイズできます。
- PAPER
This sets the
'papersize'
key oflatex_elements
: i.e.PAPER=a4
sets it to'a4paper'
andPAPER=letter
to'letterpaper'
.注釈
Usage of this environment variable got broken at Sphinx 1.5 as
a4
orletter
ended up as option to LaTeX document in place of the neededa4paper
, resp.letterpaper
. Fixed at 1.7.7.
- SPHINXBUILD
sphinx-build
の代わりに用いるコマンドです。
- BUILDDIR
sphinx-quickstart で選択した以外のビルドディレクトリを使用します。
- SPHINXOPTS
Additional options for sphinx-build. These options can also be set via the shortcut variable O (capital 'o').
- NO_COLOR
When set (regardless of value), sphinx-build will not use color in terminal output.
NO_COLOR
takes precedence overFORCE_COLOR
. See no-color.org for other libraries supporting this community standard.バージョン 4.5.0 で追加.
- FORCE_COLOR
When set (regardless of value), sphinx-build will use color in terminal output.
NO_COLOR
takes precedence overFORCE_COLOR
.バージョン 4.5.0 で追加.
Deprecation Warnings¶
If any deprecation warning like RemovedInSphinxXXXWarning
are displayed
when building a user's document, some Sphinx extension is using deprecated
features. In that case, please report it to author of the extension.
To disable the deprecation warnings, please set PYTHONWARNINGS=
environment
variable to your environment. For example:
PYTHONWARNINGS= make html
(Linux/Mac)export PYTHONWARNINGS=
として、make html
を実行する(Linux/Mac)set PYTHONWARNINGS=
として ``make html``を実行する(Windows)modify your Makefile/make.bat and set the environment variable
参考¶
sphinx-quickstart(1)