Skip to content

Instantly share code, notes, and snippets.

@ggrossetie
Created December 28, 2017 14:00
Show Gist options
  • Save ggrossetie/782222d756b9071d2b7f272ad451488b to your computer and use it in GitHub Desktop.
Save ggrossetie/782222d756b9071d2b7f272ad451488b to your computer and use it in GitHub Desktop.

Sets additional document attributes, which override equivalently-named attributes defined in the document unless the value ends with @.

Selects the converter to use (as registered with this keyword).

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.

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 references property on the document AST object. (Experimental).

Sets the document type.

Overrides the extensions registry instance. Instead of providing a Ruby block 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.

If true, add the document header and footer (i.e., framing) around the body content in the output.

If true, the processor will create the necessary output directories if they don’t yet exist.

If true, the source is parsed eagerly (i.e., as soon as the source is passed to the load or load_file API). If false, parsing is deferred until the parse method is explicitly invoked.

Sets the safe mode.

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

An array of directories containing Tilt-compatible converter templates to be used instead of the default built-in templates.

Destination directory for output file(s), relative to base_dir.

The directory containing the source file, or the working directory if the source is read from a stream.

The name of the output file to write, or true to use the default output file (docname + outfilesuffix).

Table 1. JavaScript API options
Name Description Default value Allowed values

attributes

not set

Any number of built-in or user-defined attributes in one of the following formats:

JSON:
{'name': 'value'}
Array:
['name=value']
String:
'name=value'

backend

html5

html5, docbook5, or any backend registered through an active converter

base_dir

file path

catalog_assets

false

boolean

doctype

article

article, book, manpage or inline

extensions_registry

not set

Extensions.Registry instance

header_footer

false

boolean

mkdirs

false

boolean

parse

true

boolean

safe

secure

unsafe, safe, server or secure

sourcemap

false

boolean

template_dirs

not set

An array of file paths

to_dir

file path

to_file

not set

true, file path

Table 1. Ruby API options
Name Description Default value Allowed values CLI equivalent

:attributes

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:

Hash:
{'name'=>'value'}
Array:
['name=value']
String:
'name=value'

-a, --attributes

:backend

Selects the converter to use (as registered with this keyword).

html5

html5, docbook5, docbook45, manpage, or any backend registered through an active converter

-b, --backend

:base_dir

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

-B, --base-dir

:catalog_assets

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 references property on the document AST object. (Experimental).

false

boolean

n/a

:converter

Specifies a user-supplied Asciidoctor::Converter instance, used in place of the converter that is automatically resolved from the backend value.

not set

Asciidoctor::Converter instance

n/a (Can be emulated using a combination of -r and -b).

:doctype

Sets the document type.

article

article, book, manpage, inline

-d, --doctype

:eruby

Specifies the eRuby implementation to use for executing the converter templates written in ERB.

erb

erb, erubis

-e, --eruby

:extensions

A Ruby block that registers (and possibly defines) Asciidoctor extensions for this instance of the processor.

not set

A Ruby block that conforms to the Asciidoctor extensions API (the same code that would be passed to the Extensions.register method).

n/a (Can be emulated using -r).

:extensions_registry

Overrides the extensions registry instance. Instead of providing a Ruby block 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

Extensions::Registry instance

n/a

:header_footer

If true, add the document header and footer (i.e., framing) around the body content in the output. NOTE: The default value for this option is opposite of the default value for the CLI.

false

boolean

-s, --no-header-footer

:mkdirs

If true, the processor will create the necessary output directories if they don’t yet exist.

false

boolean

n/a (Implicitly enabled).

:parse

If true, the source is parsed eagerly (i.e., as soon as the source is passed to the load or load_file API). If false, parsing is deferred until the parse method is explicitly invoked.

true

boolean

n/a

:safe

Sets the safe mode.

:secure

:unsafe, :safe, :server, :secure

-S, --safe-mode

:sourcemap

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

n/a

:template_cache

If true, enables the built-in cache used by the template converter when reading the source of template files. Only relevant if the :template_dirs option is specified.

true

boolean

n/a

:template_dir

Specifies a directory of Tilt-compatible templates to be used instead of the default built-in templates. Deprecated. Please use :template_dirs instead.

not set

file path

-T, --template-dir

:template_dirs

An array of directories containing Tilt-compatible converter templates to be used instead of the default built-in templates.

not set

An array of file paths

-T, --template-dir

:template_engine

Template engine to use for the custom converter templates. The gem with the same name as the engine will be loaded automatically. This name is also used to build the full path to the custom converter templates.

auto
(Set based on the file extension of the custom converter templates found).

Template engine name (e.g., slim, haml, erb, etc.)

-E, --template-engine

:template_engine_options

Low-level options passed directly to the template engine.

not set

A nested Hash of options with the template engine name as the top-level key and the option name as the second-level key.

n/a

:timings

Capture time taken to read, parse, and convert document. Internal use only.

not set

Asciidoctor::Timings instance

-t, --timings

:to_file

The name of the output file to write, or true to use the default output file (docname + outfilesuffix).

not set

true, file path

-o, --out-file

:to_dir

Destination directory for output file(s), relative to base_dir.

The directory containing the source file, or the working directory if the source is read from a stream.

file path

-D, --destination-dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment