gitbook 2.0

緣起

剛依照之前寫的「這篇」,幫朋友安裝gitbook這個指令工具,才發現目前已經改成2.0版了。

當執行「npm intall gitbook -g」後,然後執行「gitbook」。

會看到下面的訊息

1
2
3
You need to install 'gitbook-cli' to have access to the gitbook command anywhere on your system.
If you've installed this package globally, you need to uninstall it.
>> Run 'npm uninstall -g gitbook' then 'npm install -g gitbook-cli'

所以到「github」或是「npm」上看,裝方式要改為

1
$ npm install gitbook-cli -g

裝好之後,執行

1
$ gitboook

會顯示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Usage: gitbook [options] [command]


Commands:

versions list installed versions
versions:print print current version to use in the current directory
versions:available list available versions on NPM
versions:install [version] force install a specific version of gitbook
versions:link [version] [folder] link a version to a local folder
versions:uninstall [version] uninstall a specific version of gitbook
help list commands for a specific version of gitbook
* run a command with a specific gitbook version

Options:

-h, --help output usage information
-V, --version output the version number
-v, --gitbook [version] specify GitBook version to use
-d, --debug enable verbose error

執行

1
$ gitbook -V

會顯示

1
0.3.3

然後執行

1
$ gitbook versions

會顯示

1
2
There is no versions installed
You can instal the latest version using: "gitbook versions:install latest"

照著上面的提示,執行

1
$ gitbook versions:install latest

會看到

1
2
3
4

...略...

Version 2.0.1 has been installed

然後再執行

1
$ gitbook versions

會顯示

1
2
3
Versions Installed:

2.0.1

執行

1
$ gitbook help

則會顯示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
build [book] [output]          build a book
--format Format to build to (Default is website; Values are website, json, ebook)
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)

pdf [book] [output] build a book to pdf
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)

epub [book] [output] build a book to epub
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)

mobi [book] [output] build a book to mobi
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)

serve [book] Build then serve a gitbook from a directory
--port Port for server to listen on (Default is 4000)
--lrport Port for livereload server to listen on (Default is 35729)
--watch Enable/disable file watcher (Default is true)
--format Format to build to (Default is website; Values are website, json, ebook)
--log Minimum log level to display (Default is info; Values are debug, info, warn, error, disabled)

install [book] install plugins dependencies

init [directory] create files and folders based on contents of SUMMARY.md

看起來「之前的基本操作方式」還是一樣。

另外再執行下面的指令

1
$ gitbook versions:print

會顯示

1
Current version is 2.0.1

執行

1
$ gitbook versions:available

會顯示

1
2
3
4
5
6
7
Available Versions:

2.0.1, 2.0.0, 2.0.0-beta.5, 2.0.0-beta.4, 2.0.0-beta.3, 2.0.0-beta.2, 2.0.0-beta.1, 2.0.0-alpha.9, 2.0.0-alpha.8, 2.0.0-alpha.7, 2.0.0-alpha.6, 2.0.0-alpha.5, 2.0.0-alpha.4, 2.0.0-alpha.3, 2.0.0-alpha.2, 2.0.0-alpha.1

Tags:

latest : 2.0.1

以上初步發現。

更多參考