If you've found this module to be useful and wish to support it, you may do so by visiting this pledgie campaign:
The main purpose for gitbook-setup is to allow creation of documents with custom design and structure and deployment of them to a different platforms or servers easily. Imagine to build a whole website with markdown syntax! It's possible with gitbook-setup because gitbook allows creation of themes and they define the design and structure of the document.
# NAV
- Home
- About
- Blog
- Contact
# Home
There is the home page content
# About
There is the about page content
[Button link="http://www.google.com"] This is a button that opens Google [/Button]
The example above is a Markdown example document that can be used to build a website and is totally independent from the design and structure. Basically the idea is to provide an easy method to build things and Markdown is one of the most easy one because it's language is very similar with the human's one.
$ npm install -g gitbook-setup
$ gitbook-setup [help]
$ npm install --save gitbook-setup
var gitbook_setup = require('gitbook-setup')
var info = {
name: "title",
deploys: "heroku"
}
gitbook_setup.create(info, (err, allInfo) => {
if (err) console.log(err)
else {
console.log("Book summary: ")
console.log(allInfo)
}
})
Optionally info can have a path variable to create the document at that path:
var gitbook_setup = require('gitbook-setup')
var info = {
name: "title",
deploys: "heroku",
path: "/home/rudy/Desktop/Docs/"
}
gitbook_setup.create(info, (err, allInfo) => {
if (err) console.log(err)
else {
console.log("Book summary: ")
console.log(allInfo)
}
})
Name | Version |
---|---|
Nodejs | >= 8.x.x |
NPM | >= 3.x.x |
- Create
- Install
- Deploy
You have now three options for creating a book:
- Passing book configuration through arguments.
- Giving a file with the whole configuration.
- In interactive form. The program will ask you for all information.
The creation of a book by interactive form is the most user-friendly. The argument form of creation is useful when you want to create a lot of books for example and fast for students. The file method of creation could be useful when you want to send through the network the book information to create it in other place for example I could send a file configuration to China and there they can create the book.
To create a book you have to execute
> gitbook-setup create [interactive (default) | args | file -f <filename> ]
If you want to create a book by arguments you have these fields:
- -n bookname (required)
- -t book (default) | api | faq | own:moduleName
- -d heroku | gh-pages | moduleName
- -a author/s
- -i description
Example 1 - Simplest book
> gitbook-setup create args -n Sample
Example 2 - Simplest book with my own template
> gitbook-setup create args -n Sample -t own:myTemplate
Example 3 - Book deployed to Heroku
> gitbook-setup create args -n Sample -d heroku
Example 4 - Book deployed to Heroku and gh-pages
> gitbook-setup create args -n Sample -d heroku,gh-pages
Example 5 - Book titled 'Our Piano History' with the template 'Classical Sheets', deployed to heroku, gh-pages and my server 'BestMusic', written by Frederic Chopin and Sergei Rachmaninoff and with some description about the book
> gitbook-setup create args -n 'Our Piano History' -t own:'Classical Sheets' -d heroku,gh-pages,BestMusic -a 'Frederic Chopin','Sergei Rachmaninoff' -i 'Amazing story about our piano lifes'
If you saw the output of the previous examples you have to create a file with the identical content. For example you want a book title myBook that allows deployment to heroku you have to create a file like that:
This file will create the same book:
Because by defaut the type is book.
The field name is a requirement. All other fields are optional.
The program will just ask you for all fields and you will fill them.