visit our site

Creating books with GitBook

In Development

by Alex Chaplinsky by April 16, 2014

If you are doing some books/docs writing or attempting to create your first book, you might get interested in this exceptionally nice tool – gitbook. It is a technical book building tool that allows you to embed code samples and exercises, and then generate a great online book that can be hosted on GitHub or any other web hosting.

Moreover, from a loosely structured bunch of MarkDown files, you can customize output format to generate not only a static site, but also PDF, eBook, json or single HTML page. No manual markup and styling required. You get a clean and pretty usable interface right out of the box.

Gitbook Interface

Gitbook Interface

Simple setup

Gitbook is a node.js package. So, in order to use it, you should have **npm** installed.

You can serve a repository as a book by using:

To start your first book, you have to create 2 files – and First one is a preface and second one is the main file which is going to be used to build the book structure. And it looks like this:

You can easily build a static website using:

Real life example

To try this tool, I decided to take Marionette.js documentation (with official version now available as tree on markdown files on github) and to build it as a static site. Which is pretty comfortable to read and maintain.


Gitbook is currently in active development and it gets updated frequently. It also supports features like theming and translations. Gitbook is extremely easy to use and it could also be used to generate documentation, not only to writes books. I sincerely advice to check it out –!

* Railsware is a premium software development consulting company, focused on delivering great web and mobile applications. Learn more about us.
  • sergii

    A good starting point to begin, Alex! Tnx!

  • Pingback: So Many Publishing Platforms, So Little Time § No Categories()

  • Hi! Your project has a nice documentation. But in the source of the gitbook I don’t see any boo.json config… How did you setup this nice header with github button and other stuff?

  • 橘子

    Hi Alex, thanks for the great demo
    There’s problems with me, first is all the plugins, search, fontsettings and sharing don’t even show in html page.
    BTW, I think u’ve edited the original style and I’m wondering if u will share the tips :)

    • Alexander Chaplinsky

      Hey there,

      It is really strange that you’re experiencing issues with default gitbook UI, because all of this plugins should work out of the box. As for styles, you can update theme or create your custom theme if you need to.

      • 橘子

        Thanks for reply :)
        I’ve issue that on main branch and I think it’s maybe something wrong with my mamp :(
        BTW is there a topic about how to install theme for gitbook? I’ve found some online, like npm install but not work for me.

      • Muhammad Muhajir

        What theme do you use actually? Do you use default theme? Because i looks different with mine.

  • Now installation with npm install gitbook-cli
    Should update this article. :)

Signup for our weekly newsletter

Want to get more of Railsware blog?

RSS Feed

We're always ready to help!

Contact us