No commit activity in last 3 years
No release in over 3 years
Asciidoctor HTMLBook is an Asciidoctor backend for converting AsciiDoc documents to HTMLBook documents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 5.0
~> 10.0

Runtime

~> 4.0
 Project Readme

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:

$ bundle

Or install it yourself as:

$ gem install asciidoctor-htmlbook

Usage

CLI

$ asciidoctor-htmlbook basic-example.adoc

or

$ asciidoctor -r asciidoctor-htmlbook basic-example.adoc

For more options:

$ asciidoctor-htmlbook -h

API

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.convert

Convert 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.convert

Render 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: true

Provide 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.