# export GIT_HOME="/"
# source $GIT_HOME/docs/doc_build_aliases.sh
#
# Elasticsearch
alias docbldesx='$GIT_HOME/docs/build_docs --doc $GIT_HOME/elasticsearch/docs/reference/index.asciidoc --resource=$GIT_HOME/elasticsearch/x-pack/docs/ --chunk 1'
alias docbldes=docbldesx
# Elasticsearch 6.2 and earlier
alias docbldesold='$GIT_HOME/docs/build_docs --doc $GIT_HOME/elasticsearch/docs/reference/index.x.asciidoc --resource=$GIT_HOME/elasticsearch-extra/x-pack-elasticsearch/docs/ --chunk 1'
在这里,要正确构建 elasticsearch,需要提供--resource参数来指向一些存储于其他目录的资源,比如这里的 x-pack 目录。而6.2及之前的版本,由于目录组织形式,以及文件的差异,命令上有细微的差异。这里的--chunk,表示的以多细的颗粒度进行 html 页面的拆分,1 表示以章节为单位进行拆分。
我们可以通过帮助命令得知:
INFO:build_docs: Build local docs:
INFO:build_docs:
INFO:build_docs: build_docs --doc path/to/index.asciidoc [opts]
INFO:build_docs:
INFO:build_docs: Opts:
INFO:build_docs: --chunk 1 Also chunk sections into separate files
INFO:build_docs: --alternatives ::
INFO:build_docs: Examples in alternative languages.
INFO:build_docs: --lang Defaults to 'en'
INFO:build_docs: --lenient Ignore linking errors
INFO:build_docs: --out dest/dir/ Defaults to ./html_docs.
INFO:build_docs: --resource Path to image dir - may be repeated
INFO:build_docs: --respect_edit_url_overrides
INFO:build_docs: Respects `:edit_url:` overrides in the book.
INFO:build_docs: --single Generate a single HTML page, instead of
INFO:build_docs: a chunking into a file per chapter
INFO:build_docs: --suppress_migration_warnings
INFO:build_docs: Suppress warnings about Asciidoctor migration
INFO:build_docs: issues. Use this when building "old" branches.
INFO:build_docs: --toc Include a TOC at the beginning of the page.
INFO:build_docs: --private Indicate that the github repo is private.
INFO:build_docs: WARNING: Anything in the `out` dir will be deleted!
INFO:build_docs:
INFO:build_docs: Build docs from all repos in conf.yaml:
INFO:build_docs:
INFO:build_docs: build_docs --all [opts]
INFO:build_docs:
INFO:build_docs: Opts:
INFO:build_docs: --keep_hash Build docs from the same commit hash as last time
INFO:build_docs: --linkcheckonly Skips the documentation builds. Checks links only.
INFO:build_docs: --push Commit the updated docs and push to origin
INFO:build_docs: --announce_preview
INFO:build_docs: Causes the build to log a line about where to find
INFO:build_docs: a preview of the build if anything is pushed.
INFO:build_docs: --rebuild Rebuild all branches of every book regardless of
INFO:build_docs: what has changed
INFO:build_docs: --reference Directory of `--mirror` clones to use as a
INFO:build_docs: local cache
INFO:build_docs: --repos_cache Directory to which working repositories are cloned.
INFO:build_docs: Defaults to `/.repos`.
INFO:build_docs: --skiplinkcheck Omit the step that checks for broken links
INFO:build_docs: --sub_dir Use a directory as a branch of some repo
INFO:build_docs: (eg --sub_dir elasticsearch:master:~/Code/elasticsearch)
INFO:build_docs: --target_repo Repository to which to commit docs
INFO:build_docs: --target_branch Branch to which to commit docs
INFO:build_docs: --user Specify which GitHub user to use, if not your own
INFO:build_docs:
INFO:build_docs: General Opts:
INFO:build_docs: --asciidoctor Emit a happy message.
INFO:build_docs: --conf Use your own configuration file, defaults to the
INFO:build_docs: bundled conf.yaml
INFO:build_docs: --direct_html Emit a happy message.
INFO:build_docs: --in_standard_docker
INFO:build_docs: Specified by build_docs when running in
INFO:build_docs: its container
INFO:build_docs: --open Open the docs in a browser once built.
INFO:build_docs: --procs Number of processes to run in parallel, defaults
INFO:build_docs: to 3
INFO:build_docs: --verbose Output more logs
增加--single参数,我们可以将整个文档打包到单一的 HTML 文件当中。接下来我们将 elasticsearch 文档为例,选择性的生成一个 7.10 的文档。
之前写过一篇如何生成离线官方文档的文章,但也有社区伙伴反馈说,是不是能够导出一个 pdf 格式的离线文档。将 html 转换成pdf,网上有非常多的工具。但这个事情最大的难点在于:一份官方文档是以 book 的形式组织的。包含多个子页面,通过目录和链接进行跳转。而现有的工具只能将单页的 html 转换为 pdf。以 elasticsearch 的官方文档为例,里面包含了7000多个子页面,根据目录,通过 url 进行跳转的方式。
为什么被折叠?