Giter Club home page Giter Club logo

gitbook-starter-kit's Introduction

gitbook-starter-kit

GitBookのスターターキット。

以下のスライドでこの構成がどのように使われているかを解説しています。

実際にこの構成を利用しているプロジェクトとして以下のものがあります。

インストール

GitBookを使った書籍を以下のようにするだけで書き始めることができます。

git clone https://github.com/azu/gitbook-starter-kit.git your-book-name
cd your-book-name
npm install
# 必要に応じて不要な.git履歴を削除
rm -rf .git/
git init

使い方

npm start

GitBookのローカルサーバが立ち上がり、 http://localhost:4000/ にアクセスすることでプレビューできます。

npm run build

単純にビルドだけをしたい場合は、npm run buildで行うことができます。 (_book/にHTMLファイルが生成されます。)

文章を追加する

gitbook-starter-kitでは以下のようなディレクトリ構造になっています。

.
├── README.md
├── SUMMARY.md <= 目次
├── ja/ <= .mdの文章を追加する
├── prh.yml
├── src/ <= サンプルコード
└── test/ <= サンプルコードのテスト

文章を追加するja/というディレクトリ名には独別な意味はないため好きな名前に変更して問題ありません。

文章を追加する場合は以下の手順で行うことができます。

  1. ja/ 以下にMarkdownファイルで文章を追加する
  2. SUMMARY.md に追加したMarkdownファイルへのリンクを書く

追加した後はnpm startなどでGitBookでプレビューすれば表示を確認することができます。 (デフォルトで自動的にリロードされるようになっています。)

テスト

npm test

npm testで以下のテストが実行されます。

  • ESLintでのコードチェック
  • textlintでの文章チェック
  • Mochaでのサンプルコードのテスト

並列でテストを実行できるようにnpm-run-allを利用しています。 テスト結果の表示が混ざるのが気になる場合は、--parallelオプションを外してみてください。

textlint

textlintを使った文章のチェックが行われます。 デフォルトでは技術書向けの設定が導入されているため目的にあわせてtextlintのルールを設定してください。

表記揺れ

prh.ymlに辞書を追加することで表記揺れをチェックすることができます。 詳しい設定方法については以下を参照してください。

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

gitbook-starter-kit's People

Contributors

azu avatar greenkeeper[bot] avatar greenkeeperio-bot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.