LoginSignup
27
27

More than 5 years have passed since last update.

GitBookの使用例

Last updated at Posted at 2015-04-06

GitBookとは

基本的には、ページをMarkdownで書いて、様々なフォーマットで出力するタイプのWebページ、電子書籍メーカーと言う感じのものです。nodeで作られています。

見た目は、html,cssなどでカスタマイズします。動作の方は、javascript,jqueryなどです。もちろん、html,cssなどは、slim,sassなどを使っても良いですし、ビルドを簡単にする設定なども書けます。


  Usage: gitbook [options] [command]

  Commands:

    build [options] [source_dir] Build a gitbook from a directory
    serve [options] [source_dir] Build then serve a gitbook from a directory
    install [options] [source_dir] Install plugins for a book
    pdf [options] [source_dir] Build a gitbook as a PDF
    epub [options] [source_dir] Build a gitbook as a ePub book
    mobi [options] [source_dir] Build a gitbook as a Mobi book
    init [source_dir]      Create files and folders based on contents of SUMMARY.md
    publish [source_dir]   Publish content to the associated gitbook.io book
    git:remote [source_dir] [book_id] Adds a git remote to a book repository

  Options:

    -h, --help     output usage information
    -V, --version  output the version number


GitBook Sample

$ sudo npm update

$ sudo npm install gitbook -g
or
$ sudo npm install gitbook-cli -g

$ git clone https://github.com/onigra/gitbook-sample

$ cd gitbook-sample

$ gitbook build

$ gitbook serve
or
$ jekyll server

# Macの場合のプレビュー
$ bash -c "open -a Safari http://localhost:4000"

# Linuxの場合のプレビュー
$ bash -c "firefox localhost:4000"

training

Middlemanのgitbook風のテンプレートもあります。

$ rvm use 2.0.0

$ git clone https://github.com/catalyzeio/training

$ cd training

$ bundle install

$ middleman server

# Macの場合のプレビュー
$ bash -c "open -a Safari http://localhost:4000"

# Linuxの場合のプレビュー
$ bash -c "firefox localhost:4000"

ここで、カスタマイズ例として、モバイルに対応する設定を書いておきます。このままでは、横幅が空白になっているので、場合によっては見づらいかと。

source/assets/css/screen.css.scss#L609
@media (max-width: $tablet-width) {
  .tocify-wrapper {
    left: -$nav-width;

    &.open {
      left: 0;
    }
  }

  .page-wrapper {
    margin-left: 0;
    //ここに追記
    word-break: break-all;
  }

もしかすると、何らかの意図があるのかもしれないので、PRは送りません。

もしgitbookで使いたければ、以下のコマンドです。

$ cd old/hipaa.intro/

$ gitbook serve
or
$ gitbook build
$ cd _book
$ jekyll server

# Linuxの場合
$ bash -c "firefox localhost:4000"

$ gitbook build

記事を書く時は、training/old/hipaa.intro/SUMMARY.mdを見て、変更すれば良いと思われます。

ページを公開するには、gitbook buildで作成された_bookフォルダをアップロードします。

27
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
27