CLI Options
Security settings
- -B, --base-dir=DIR
-
Base directory containing the document and resources. Defaults to the directory containing the source file, or the working directory if the source is read from a stream. Can be used as a way to chroot the execution of the program.
- -S, --safe-mode=SAFE_MODE
-
Set safe mode level: unsafe, safe, server or secure. Disables potentially dangerous macros in source files, such as
include::[]
. If not set, the safe mode level defaults to unsafe when Asciidoctor is invoked using this script.
Document settings
- -a, --attribute=ATTRIBUTE
-
Define, override or delete a document attribute. Command-line attributes take precedence over attributes defined in the source file.
ATTRIBUTE is normally formatted as a key-value pair, in the form NAME=VALUE. Alternate acceptable forms are NAME (where the VALUE defaults to an empty string), NAME! (unassigns the NAME attribute) and NAME=VALUE@ (where VALUE does not override value of NAME attribute if it’s already defined in the source document). Values containing spaces should be enclosed in quotes.
This option may be specified more than once.
- -b, --backend=BACKEND
-
Backend output file format: html5, docbook5, and manpage are supported out of the box. You can also use the backend alias names html (aliased to html5) or docbook (aliased to docbook5). Defaults to html5. Other options can be passed, but if Asciidoctor cannot find the backend, it will fail during conversion.
- -d, --doctype=DOCTYPE
-
Document type: article, book, manpage or inline. Sets the root element when using the docbook backend and the style class on the HTML body element when using the html backend. The book document type allows multiple level-0 section titles in a single document. The manpage document type enables parsing of metadata necessary to produce a manpage. The inline document type allows the content of a single paragraph to be formatted and returned without wrapping it in a containing element. Defaults to article.
Document Conversion
- -D, --destination-dir=DIR
-
Destination output directory. Defaults to the directory containing the source file, or the working directory if the source is read from a stream. If specified, the directory is resolved relative to the working directory.
- -e, --embedded
-
Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. This option is useful for producing documents that can be inserted into an external template.
- -n, --section-numbers
-
Auto-number section titles. Synonym for --attribute numbered.
- -o, --out-file=OUT_FILE
-
Write output to file OUT_FILE. Defaults to the base name of the input file suffixed with backend extension. If the input is read from standard input, then the output file defaults to stdout. If OUT_FILE is - then the standard output is also used. If specified, the file is resolved relative to the working directory.
- -r, --require=LIBRARY
-
Rrequire the specified library before executing the processor, using the standard Node
require
. This option may be specified more than once. - -s, --no-header-footer
-
Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. This option is useful for producing documents that can be inserted into an external template.
- -T, --template-dir=DIR
-
A directory containing custom converter templates that override one or more templates from the built-in set. Asciidoctor.js supports EJS (
.ejs
), Handlebars (.handlebars
,.hbs
), Nunjucks (.nunjucks
,.njk
), Pug (.pug
) and Template Literals (.js
).Please note that the dependencies are optional, so you will need to install them explicitly. For instance, if you want to use Nunjucks, you will need to install the nunjucks package:
$ npm i nunjucks
This option may be specified more than once. Matching templates found in subsequent directories override ones previously discovered.
Learn more about the Template Converter.