{"id":6773,"date":"2014-04-16T17:48:42","date_gmt":"2014-04-16T14:48:42","guid":{"rendered":"http:\/\/railsware.com\/blog\/?p=6773"},"modified":"2021-08-13T16:19:09","modified_gmt":"2021-08-13T13:19:09","slug":"creating-books-with-gitbook","status":"publish","type":"post","link":"https:\/\/railsware.com\/blog\/creating-books-with-gitbook\/","title":{"rendered":"Creating books with GitBook"},"content":{"rendered":"\n<p>If you are doing some books\/docs writing or attempting to create your first book, you might get interested in this exceptionally nice tool &#8211; <a title=\"Gitbook\" href=\"http:\/\/gitbook.io\">gitbook<\/a>. 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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<div class=\"wp-block-image wp-image-6816\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1317\" height=\"902\" src=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2014\/04\/preview1.png\" alt=\"Gitbook Interface\" class=\"wp-image-6816\"\/><figcaption>Gitbook Interface<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Simple setup<\/h2>\n\n\n\n<p>Gitbook is a node.js package. So, in order to use it, you should have **npm** installed.<br><code><\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npm install -g gitbook<\/pre>\n\n\n\n<p>You can serve a repository as a book by using:<br><code><\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gitbook serve .\/repository<\/pre>\n\n\n\n<p>To start your first book, you have to create 2 files &#8211; <code>README.md<\/code> and <code>SUMMARY.md<\/code>. 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:<br><code><\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">* [Configuration](marionette\/configuration\/configuration.md)\n    * [Renderer](marionette\/configuration\/renderer.md)\n    * [TemplateCache](marionette\/configuration\/template_cache.md)\n* [View](marionette\/view\/view.md)\n    * [Item View](marionette\/view\/item_view.md)\n    * [Collection View](marionette\/view\/collection_view.md)\n    * [Composite View](marionette\/view\/composite_view.md)\n<\/pre>\n\n\n\n<p>You can easily build a static website using:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">gitbook build .\/repository -o .\/outputFolder -f pdf<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Real life example<\/h2>\n\n\n\n<p>To try this tool, I decided to take <a href=\"https:\/\/github.com\/marionettejs\/backbone.marionette\" target=\"_blank\" rel=\"noopener noreferrer\">Marionette.js<\/a> 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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>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 &#8211; gitbook.io!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are doing some books\/docs writing or attempting to create your first book, you might get interested in this exceptionally nice tool &#8211; 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&#8230;<\/p>\n","protected":false},"author":23,"featured_media":9447,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[],"coauthors":["Alex Chaplinsky"],"class_list":["post-6773","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"acf":[],"aioseo_notices":[],"categories_data":[{"name":"Engineering","link":"https:\/\/railsware.com\/blog?category=development"}],"post_thumbnails":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2014\/04\/preview1.png","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/6773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/comments?post=6773"}],"version-history":[{"count":55,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/6773\/revisions"}],"predecessor-version":[{"id":14055,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/6773\/revisions\/14055"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media\/9447"}],"wp:attachment":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media?parent=6773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/categories?post=6773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/tags?post=6773"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/coauthors?post=6773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}