Convert options
This document describes the list of options you can use when converting a document.
| Name | Description | Default value | Allowed values | 
|---|---|---|---|
  | 
Sets additional document attributes, which override equivalently-named attributes defined in the document unless the value ends with   | 
not set  | 
Any number of built-in or user-defined attributes in one of the following formats: JSON:  | 
  | 
Selects the converter to use (as registered with this keyword).  | 
html5  | 
html5, docbook5, or any backend registered through an active converter  | 
  | 
Sets the base (aka working) directory containing the document and resources.  | 
The directory of the source file, or the working directory if the source is read from a stream.  | 
file path  | 
  | 
If true, tells the parser to capture images and links in the reference table. (Normally only IDs, footnotes and indexterms are included). The reference table is available via the   | 
false  | 
boolean  | 
  | 
Sets the document type.  | 
article  | 
article, book, manpage or inline  | 
  | 
Overrides the extensions registry instance. Instead of providing a JavaScript function containing extensions to register, this option lets you replace the extension registry itself, giving you complete control over how extensions are registered for this processor.  | 
not set  | 
  | 
  | 
If true, the processor will create the necessary output directories if they don’t yet exist.  | 
false  | 
boolean  | 
  | 
If true, the source is parsed eagerly (i.e., as soon as the source is passed to the   | 
true  | 
boolean  | 
  | 
Sets the safe mode.  | 
secure  | 
unsafe, safe, server or secure  | 
  | 
Keeps track of the file and line number for each parsed block. (Useful for tooling applications where the association between the converted output and the source file is important).  | 
false  | 
boolean  | 
  | 
If true, add the document header and footer (i.e., framing) around the body content in the output.  | 
false  | 
boolean  | 
  | 
An array of directories containing templates to be used instead of the default built-in templates.  | 
not set  | 
An array of file paths  | 
  | 
Destination directory for output file(s), relative to   | 
The directory containing the source file, or the working directory if the source is read from a stream.  | 
file path  | 
  | 
The name of the output file to write, or true to use the default output file (  | 
not set  | 
true, file path  | 
Usage
In the following example, we define the safe option to unsafe and we also define two attributes:
showtitle- 
display the title of an embedded document
 icons- 
use font icons instead of text for admonitions
 
var content = '= Document title'
var html = asciidoctor.convert(content, { 'safe': 'server', 'attributes': { 'showtitle': true, 'icons': 'font' } })
console.log(html)
// <h1>Document title</h1>
| You can read more about document attributes on asciidoctor.org/docs/user-manual/#attribute-catalog |