Asciidoctor HTMLBook
Asciidoctor HTMLBook is an Asciidoctor backend for converting AsciiDoc documents to HTMLBook documents.
Installation
Add this line to your application’s Gemfile:
gem 'asciidoctor-htmlbook'And then execute:
$ bundleOr install it yourself as:
$ gem install asciidoctor-htmlbookUsage
CLI
$ asciidoctor-htmlbook basic-example.adocor
$ asciidoctor -r asciidoctor-htmlbook basic-example.adocFor more options:
$ asciidoctor-htmlbook -hAPI
To use Asciidoctor in your application, you first need to require the gem:
require 'asciidoctor/htmlbook'Load and Convert a File Using the API
Load from file:
doc = Asciidoctor.load_file 'mysample.adoc', backend: 'htmlbook'
puts doc.convertConvert file:
Asciidoctor.convert_file 'mysample.adoc', backend: 'htmlbook'Load and Convert Strings Using the API
Load from string:
doc = Asciidoctor.load '*This* is Asciidoctor.', backend: 'htmlbook'
puts doc.convertRender string:
Asciidoctor.convert '*This* is Asciidoctor.', backend: 'htmlbook'When rendering a string, the header and footer are excluded by default to make Asciidoctor consistent with other lightweight markup engines like Markdown. If you want the header and footer, just enable it using the :header_footer option:
Asciidoctor.convert '*This* is Asciidoctor.', backend: 'htmlbook', header_footer: trueProvide Custom Templates
You can overwrite default templates by adding :template_dir option:
Asciidoctor.convert '*This* is Asciidoctor.', backend: 'htmlbook', template_dir: 'path/to/templates'|
Note
|
asciidoctor-htmlbook template do not compatible with asciidoctor built-in template backend. View ./templates for more info. |
Development
After checking out the repo, run bin/setup to install dependencies. Then, run bin/rake to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/chloerei/asciidoctor-htmlbook. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.