Introduction · GitBook


GitBook is both an online platform for writing and hosting documentation, and an open source book format and toolchain. Hundreds of thousands of users use GitBook to write documentation (library, API, tools, etc.), or knowledge bases (like this F.A.Q.). People also use GitBook to publish technical books, teaching material, and many other things.

We can use gitbook to build our wiki page and following pic is just for reference GitBook helps my team write, collaborate and publish content online. It is very uselul to system express some basic knowledge, so I choice gitbook to record my class.


How to build a Web page with gitbook

Basic tool

  • I use Macbook and Terminal( software)
  • node.js
  • GIt
  • gitlab

Method

1.Install node.js

* Download and install it
* In git, code `node -v`,show the edition of node.js
$ node -v
DouboydeMacBook-Pro:~ douboy$ node -v
v8.9

2.Install gitbook

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

Git will show the result

$ DouboydeMacBook-Pro:~ huixing$ gitbook -V
CLI version: 2.3.0
GitBook version: 3.2.2

3.GitLab CI

This project's static Pages are built by GitLab CI, following the steps defined in .gitlab-ci.yml(we can find it in the branch of gitlab):

# requiring the environment of NodeJS 8.9.x LTS (carbon)
image: node:8.9

# add 'node_modules' to cache for speeding up builds
cache:
  paths:
    - node_modules/ # Node modules and dependencies

before_script:
  - npm install gitbook-cli -g # install gitbook
  - gitbook fetch latest # fetch latest stable version
  - gitbook install # add any requested plugins in book.json
  #- gitbook fetch pre # fetch latest
  #- gitbook fetch 2.6.7 # fetch specific version

# the 'pages' job will deploy and build your site to the 'public' path
pages:
  stage: deploy
  script:
    # Build gitlab pages to public folder
    - mkdir .public
    - cp -r * .public
    - mv .public public
    - rm -rf public/Fabclass
    # Build gitbook into public/docs directory,Fabclass is my location of gitbook content,and I attach the pic in the following pic
    - gitbook build ./Fabclass public/Fabclass
  artifacts:
    paths:
      - public
  only:
    - master # this job will affect only the 'master' branch

4.build folder

The following is the condition in sublime We can edit them.

5.Add the content of gitbook 6.Updata the summary in gitbook folder, and then save reference the following two picture 7.Push

$ git add --all
$ git commit  -m "write commit"
$ git push

results matching ""

    No results matching ""