Asciibook has a plugin mechanism to extend its functions. You can modify asciidoc parsing, add macro processing, or use third-party themes through plugins.
Add the plugin by command line:
Plugin is Ruby Gem or Ruby script. For Ruby gem, use gem name as plugin value. For script file, use file path as plugin value.
Using plugin will actually execute the Ruby code in the plugin, which can extend any function of asciibook, but it may also cause security risks. This includes deleting documents or uploading sensitive information to third-party websites.
Make sure to only use asciibook to process trusted documents, and always build documents in a docker container.
Example 1: Ruby Gem
we can add
asciidoctor-diagram to support diagram.
First, install Ruby gem and Java runtime(require by ditaa) in container:
For difference diagram types need to install different dependencies, check the documentation for details:
Then add config in
Now we can use ditaa in asciidoc:
Ditaa source will generate a image.
Example 2: Ruby Script
If Ruby gem needs config, we can add a ruby script as plugin.
asciidoctor-plantuml is a plugin to use external server as plantuml generator.
First, install ruby gem:
Add this content to file
Then add this file as plugin in
Now asciibook will generate plantuml by plantuml.com .
It should be noted that the dependencies installed in the container will disappear after exiting. To persist dependencies, you need to Build Docker Image.