GitBook 2.0.0: Content References, AsciiDoc, Plugins, ...

We just released the version 2.0.0-alpha of GitBook. This version includes many changes and some exciting improvements !

GitBook v2.0.0

This 2.0.0 release brings a huge set of improvements for GitBook, adding many requested features while also fixing a few bugs, it will slowly transition from alpha to stable over the coming weeks. In the meantime you can already use it on GitBook.com and locally; you can be part of the discussion on GitHub.

Template Engine

This new release introduces a template engine processed before the markup parsers, it leverages Mozilla’s Nunjucks library providing a simple syntax which can be extended by plugins ! Allowing for a whole new category of block based plugins. Here’s an overview of what GitBook’s processing pipeline now looks like :

Process of GitBook 2.0.0

This template engine allows you to inject variables from book.json configuration:

This is my {{ book.myVariable }}.

To learn more check out our templating documentation.

AsciiDoc, reStructuredText parsers

Support for markup languages other than Markdown was a highly requested feature. The 2.0.0 release removes the unique dependence to Markdown to bring support to AsciiDoc and reStructuredText; these two parsers are currently in alpha and will be improved during the evolution of the 2.x.x release.

Content References: Internal and External

Authors, especially technical writers, really wanted to use “content references”, also known as “conrefs”, when writing documentation. A conref allows you to write a chunk of text once and reuse it throughout the book. (The idea was borrowed from the DITA standard).

{% include "./myFile.md" %}

Not only can you include local blocks of content, but you can also import remotely, opening up endless new collaborative possibilities:

{% include "git+https://github.com/GitbookIO/documentation.git/README.md#1.0.1" %}

Check out the documentation to learn more.

Plugins and Extending template syntax

Plugins can now extend the templating syntax independly of the parsers (Markdown, AsciiDoc or reStructuredText). Plugins can extend both filters and blocks.

You can learn all about this new plugin feature in our documentation !

Better support of images (SVG, …) in eBook formats

GitBook 2.0.0 is a lot smarter when it comes to embeddeding images in eBooks (pdf, epub and mobi). Remote images are downloaded locally and integrated as local files during the build, and SVG images are rendered to PNGs automatically (Inline SVGs are also supported). This allows you to use cutting edge vector graphics (SVGs, …) with the peace of mind that it will render beautifuly on the web, offline and on mobile !

Math in eBook formats

GitBook counts many mathematicians, researchers and students amongst it’s users for whom formulas and equations are essential. So we’re happy to announce that the MathJax plugin has been improved to support ebook formats. Math in your books will be converted to SVG then rendered to PNGs for eBooks (pdf, epub and mobi).

How to test GitBook 2.x.x on GitBook.com

Until the 2.0.0 release is a stable release, you can test it by switching the “builder” to "Version 2.x.x" in your book’s settings. (Book Settings > Options > Publication).

How to test GitBook 2.x.x locally

GitBook now uses a separate CLI, this program does not depend on GitBook versions (supporting versions >=2.0.0).

You can install it with: npm install gitbook-cli -g, note that you’ll need to uninstall gitbook from your system before being able to install gitbook-cli.

Have feedback on this post? Let @GitBookIO know on Twitter, or contact us.