Document Attributes Reference
Document attributes are used either to configure behavior in the processor or to relay information about the document and its environment. This page catalogs all the built-in (i.e., reserved) document attributes in AsciiDoc.
Unless otherwise marked, these attributes can be modified (set or unset) from the API using the :attributes
option, from the CLI using the -a
option, or in the document (often in the document header) using an attribute entry.
Use the follow legend to understand the columns and values in the tables on this page.
Set By Default |
The attribute is automatically set and assigned a default value by the AsciiDoc processor.
The default value is indicated in bold (e.g., |
Allowable Values |
Allowable values for the attribute. Numeric values and values shown in italic are instructional and indicate a value type (e.g., any, empty, number, 1–5, etc.).
If the attribute doesn’t accept any or empty, than you must only assign one of the allowable values or specified value type. |
Header Only |
The attribute must be set or unset by the end of the document header (i.e., set by the API, CLI, or in the document header). Otherwise, the assignment won’t have any effect on the document. If an attribute is not marked as Header Only, it can be set anywhere in the document, assuming the attribute is not locked by the API or CLI. However, changing an attribute only affects behavior for content that follows the assignment (in document order). |
Intrinsic attributes
Intrinsic attributes are set automatically by the processor.
These attributes provide information about the document being processed (e.g., docfile
), the security mode under which the processor is running (e.g., safe-mode-name
), and information about the user’s environment (e.g., user-home
).
Many of these attributes are read only, which means they can’t be modified (with some exceptions). Attributes which are not are marked as modifiable. Attributes marked as both modifiable and API/CLI Only can only be set from the API or CLI. All other attributes marked as modifiable must be set by the end of the header (i.e., Header Only).
Name | Allowable Values | Modifiable | API/CLI Only | Notes |
---|---|---|---|---|
|
any |
Yes |
No |
The backend used to select and activate the converter that creates the output file.
Usually named according to the output format (e.g., |
|
empty |
No |
n/a |
A convenience attribute for checking which backend is selected.
<backend> is the value of the |
|
any |
No |
n/a |
The generic backend on which the backend is based.
Typically derived from the backend value minus trailing numbers (e.g., the basebackend for |
|
empty |
No |
n/a |
A convenience attribute for checking which basebackend is active.
<basebackend> is the value of the |
|
date (ISO) |
Yes |
No |
|
|
datetime (ISO) |
Yes |
No |
|
|
directory path |
If input is a string |
Yes |
Full path of the directory that contains the source document. Empty if the safe mode is SERVER or SECURE (to conceal the file’s location). |
|
file path |
If input is a string |
Yes |
Full path of the source document. Truncated to the basename if the safe mode is SERVER or SECURE (to conceal the file’s location). |
|
file extension |
If input is a string |
Yes |
File extension of the source document, including the leading period. |
|
file stem basename |
If input is a string |
Yes |
Root name of the source document (no leading path or file extension). |
|
time (ISO) |
Yes |
No |
|
|
empty |
No |
n/a |
A convenience attribute for checking the doctype of the document.
<doctype> is the value of the |
|
integer |
Yes |
No |
|
|
empty |
No |
n/a |
Only set if content is being converted to an embedded document (i.e., body of document only). |
|
any |
If input is a string |
Yes |
File extension of the output file name (without leading period). |
|
empty |
No |
n/a |
A convenience attribute for checking the filetype of the output.
<filetype> is the value of the |
|
|
No |
n/a |
Syntax used when generating the HTML output. Controlled by and derived from the backend name (html=html or xhtml=html). |
|
date (ISO) |
Yes |
No |
Date when the document was converted.[2] |
|
datetime (ISO) |
Yes |
No |
Date and time when the document was converted.[2] |
|
time (ISO) |
Yes |
No |
Time when the document was converted.[2] |
|
integer |
Yes |
No |
Year when the document was converted.[2] |
|
directory path |
No |
n/a |
Full path of the output directory. (Cannot be referenced in the content. Only available to the API once the document is converted). |
|
file path |
No |
n/a |
Full path of the output file. (Cannot be referenced in the content. Only available to the API once the document is converted). |
|
file extension |
Yes |
No |
File extension of the output file (starting with a period) as determined by the backend ( |
|
|
No |
n/a |
Numeric value of the safe mode setting. (0=UNSAFE, 1=SAFE, 10=SERVER, 20=SECURE). |
|
|
No |
n/a |
Textual value of the safe mode setting. |
|
empty |
No |
n/a |
Set if the safe mode is UNSAFE. |
|
empty |
No |
n/a |
Set if the safe mode is SAFE. |
|
empty |
No |
n/a |
Set if the safe mode is SERVER. |
|
empty |
No |
n/a |
Set if the safe mode is SECURE. |
|
directory path |
No |
n/a |
Full path of the home directory for the current user.
Masked as |
[1] Only reflects the last modified time of the source document file. It does not consider the last modified time of files which are included.
[2] If the SOURCE_DATE_EPOCH environment variable is set, the value assigned to this attribute is built from a UTC date object that corresponds to the timestamp (as an integer) stored in that environment variable.
This override offers one way to make the conversion reproducible.
See the source date epoch specification for more information about the SOURCE_DATE_EPOCH environment variable.
Otherwise, the date is expressed in the local time zone, which is reported as a time zone offset (e.g., -0600
) or UTC if the time zone offset is 0).
To force the use of UTC, set the TZ=UTC
environment variable when invoking Asciidoctor.
Compliance attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
|
Yes |
No |
Controls how missing attribute references are handled. |
|
|
Yes |
No |
Controls how attribute unassignments are handled. |
|
empty |
No |
No |
Controls when the legacy parsing mode is used to parse the document. |
|
empty |
No |
Yes |
Enables Button and Menu UI Macros and the Keyboard Macro. |
|
empty |
No |
Yes |
Prevents last-updated date from being added to HTML footer or DocBook info element. Useful for storing the output in a source code control system as it prevents spurious changes every time you convert the document. Alternately, you can use the SOURCE_DATE_EPOCH environment variable, which sets the epoch of all source documents and the local datetime to a fixed value. |
|
empty |
No |
Yes |
Consume YAML-style frontmatter at top of document and store it in |
Localization and numbering attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
any |
Yes |
No |
Label added before an appendix title. |
|
character |
No |
No |
Sets the seed value for the appendix number sequence.[1] |
|
any |
Yes |
No |
Signifier added to Appendix title cross references. |
|
any |
Yes |
No |
Text used to label CAUTION admonitions when icons aren’t enabled. |
|
number |
No |
No |
Sets the seed value for the chapter number sequence.[1] Book doctype only. |
|
any |
Yes |
No |
Signifier added to Chapter titles in cross references. Book doctype only. |
|
any |
No |
No |
Label added to level 1 section titles (chapters). Book doctype only. |
|
any |
Yes |
No |
Text used to label example blocks. |
|
number |
No |
No |
Sets the seed value for the example number sequence.[1] |
|
any |
Yes |
No |
Text used to label images and figures. |
|
number |
No |
No |
Sets the seed value for the figure number sequence.[1] |
|
number |
No |
No |
Sets the seed value for the footnote number sequence.[1] |
|
any |
Yes |
No |
Text used to label IMPORTANT admonitions when icons are not enabled. |
|
BCP 47 language tag |
No |
Yes |
Language tag specified on document element of the output document. Refer to the lang and xml:lang attributes section of the HTML specification to learn about the acceptable values for this attribute. |
|
any |
Yes |
Yes |
Text used for “Last updated” label in footer. |
|
any |
No |
No |
Text used to label listing blocks. |
|
number |
No |
No |
Sets the seed value for the listing number sequence.[1] |
|
any |
No |
Yes |
Label for program name section in the man page. |
|
empty |
No |
Yes |
Prevents |
|
any |
Yes |
No |
Text used to label NOTE admonitions when icons aren’t enabled. |
|
any |
Yes |
No |
Signifier added to Part titles in cross references. Book doctype only. |
|
any |
No |
No |
Label added to level 0 section titles (parts). Book doctype only. |
|
any |
No |
No |
Title text for an anonymous preface when |
|
any |
Yes |
No |
Signifier added to title of numbered sections in cross reference text. |
|
any |
Yes |
No |
Text of label prefixed to table titles. |
|
number |
No |
No |
Sets the seed value for the table number sequence.[1] |
|
any |
Yes |
No |
Text used to label TIP admonitions when icons aren’t enabled. |
|
any |
Yes |
Yes |
|
|
any |
Yes |
Yes |
Default document title if document doesn’t have a document title. |
|
any |
Yes |
Yes |
|
|
any |
Yes |
No |
Text used to label WARNING admonitions when icons aren’t enabled. |
Document metadata attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
any |
No |
Yes |
Adds |
|
any |
Extracted from author info line |
Yes |
Can be set automatically via the author info line or explicitly. See Author Information. |
|
any |
Extracted from |
Yes |
Derived from the author attribute by default. See Author Information. |
|
any |
Extracted from author info line |
Yes |
Can be set automatically via the author info line or explicitly as a comma-separated value list. See Author Information. |
|
any |
No |
Yes |
Adds |
|
any |
Yes, if document has a doctitle |
Yes |
See doctitle attribute. |
|
any |
No |
Yes |
Adds description meta element in HTML document head. |
|
any |
Extracted from author info line |
Yes |
Can be any inline macro, such as a URL. See Author Information. |
|
any |
Extracted from author info line |
Yes |
See Author Information. |
|
any |
Yes, if front matter is captured |
n/a |
If |
|
any |
No |
Yes |
Adds keywords meta element in HTML document head. |
|
any |
Extracted from author info line |
Yes |
See Author Information. |
|
any |
Extracted from author info line |
Yes |
See Author Information. |
|
any |
No |
Yes |
Adds |
|
any |
Extracted from revision info line |
Yes |
See Revision Information. |
|
any |
Extracted from revision info line |
Yes |
See Revision Information. |
|
any |
Extracted from revision info line |
Yes |
See Revision Information. |
|
any |
No |
Yes |
Value of |
Section title and table of contents attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
valid XML ID start character |
Yes |
No |
Prefix of auto-generated section IDs. See Change the ID prefix. |
|
valid XML ID character |
Yes |
No |
Word separator used in auto-generated section IDs. See Change the ID word separator. |
|
[+-]0–5 |
No |
No |
Increases or decreases level of headings below assignment. A leading + or - makes the value relative. |
|
empty |
No |
No |
Enables numbering of parts. See Number book parts. Book doctype only. |
|
empty |
No |
No |
Adds anchor in front of section title on mouse cursor hover. |
|
empty |
Yes |
No |
Generates and assigns an ID to any section that does not have an ID. See Disable automatic ID generation. |
|
empty |
No |
No |
|
|
empty |
No |
No |
Numbers sections to depth specified by |
|
0–5 |
No |
No |
|
|
any |
No |
Yes |
Character used to separate document title and subtitle. |
|
empty[= |
No |
Yes |
Turns on table of contents and specifies its location. |
|
1–5 |
No |
Yes |
|
|
empty |
No |
Yes |
Informs parser that document is a fragment and that it shouldn’t enforce proper section nesting. |
General content and formatting attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
empty |
No |
Yes |
Controls protocol used for assets hosted on a CDN. |
|
empty |
No |
Yes |
Cache content read from URIs. |
|
empty |
No |
Yes |
Embed graphics as data-uri elements in HTML elements so file is completely self-contained. |
|
empty[= |
No |
Yes |
Read input from one or more DocBook info files. |
|
directory path |
No |
Yes |
Location of docinfo files. Defaults to directory of source file if not specified. |
|
comma-separated substitution names |
No |
Yes |
AsciiDoc substitutions that are applied to docinfo content. |
|
|
Yes |
Yes |
Output document type. |
|
empty[= |
No |
Yes |
Controls automatic equation numbering on LaTeX blocks in HTML output (MathJax).
If the value is AMS, only LaTeX content enclosed in an |
|
empty |
No |
No |
|
|
empty |
No |
No |
Hides URI scheme for raw links. |
|
|
No |
Yes |
Specifies media type of output and enables behavior specific to that media type. PDF converter only. |
|
empty |
No |
Yes |
Turns off footer. |
|
empty |
No |
Yes |
Turns off footnotes. |
|
empty |
No |
Yes |
Turns off header. |
|
empty |
No |
Yes |
Hides the doctitle in an embedded document.
Mutually exclusive with the |
|
file extension |
Yes |
Yes |
File extension of output file, including dot ( |
|
integer |
No |
Yes |
Page width used to calculate the absolute width of tables in the DocBook output. |
|
empty |
No |
No |
The path prefix to add to relative xrefs. |
|
file extension |
Yes |
No |
The path suffix (e.g., file extension) to add to relative xrefs.
Defaults to the value of the |
|
empty |
No |
No |
Prints the URI of a link after the link text. PDF converter only. |
|
empty |
No |
Yes |
Displays the doctitle in an embedded document.
Mutually exclusive with the |
|
|
No |
Yes |
|
|
( |
No |
No |
Controls default value for |
|
( |
No |
No |
Controls default value for |
|
( |
No |
No |
Controls default value for |
|
integer (≥ 0) |
No |
No |
Converts tabs to spaces in verbatim content blocks (e.g., listing, literal). |
|
empty |
Yes |
Yes |
Control whether webfonts are loaded when using the default stylesheet.
When set to empty, uses the default font collection from Google Fonts.
A non-empty value replaces the |
|
|
No |
No |
Image and icon attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
url |
No |
Yes |
If not specified, uses the cdnjs.com service. Overrides CDN used to link to the Font Awesome stylesheet. |
|
any |
No |
Yes |
Overrides the name of the icon font stylesheet. |
|
empty |
Yes |
Yes |
Allows use of a CDN for resolving the icon font.
Only relevant used when value of |
|
empty[= |
No |
Yes |
Chooses images or font icons instead of text for admonitions. Any other value is assumed to be an icontype and sets the value to empty (image-based icons). |
|
directory path |
Yes |
No |
Location of non-font-based image icons.
Defaults to the icons folder under |
|
|
No |
No |
File type for image icons. Only relevant when using image-based icons. |
|
empty |
Yes |
No |
Location of image files. |
Source highlighting and formatting attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
( |
No |
Yes |
Controls whether CodeRay uses CSS classes or inline styles. |
|
|
No |
No |
Sets how CodeRay inserts line numbers into source listings. |
|
empty |
No |
Yes |
Instructs processor not to load CodeRay. Also set if processor fails to load CodeRay. |
|
directory path |
No |
Yes |
Location of the highlight.js source code highlighter library. |
|
highlight.js style name |
No |
Yes |
Name of theme used by highlight.js. |
|
directory path |
No |
Yes |
Location of non-CDN prettify source code highlighter library. |
|
prettify style name |
No |
Yes |
Name of theme used by prettify. |
|
empty |
Yes |
No |
|
|
( |
No |
Yes |
Controls whether Pygments uses CSS classes or inline styles. |
|
( |
No |
No |
Sets how Pygments inserts line numbers into source listings. |
|
Pygments style name |
No |
Yes |
Name of style used by Pygments. |
|
empty |
No |
Yes |
Instructs processor not to load Pygments. Also set if processor fails to load Pygments. |
|
( |
No |
Yes |
Controls whether Rouge uses CSS classes or inline styles. |
|
|
No |
No |
Sets how Rouge inserts line numbers into source listings. `inline` not yet supported by Asciidoctor. See asciidoctor#3641. |
|
Rouge style name |
No |
Yes |
Name of style used by Rouge. |
|
empty |
No |
Yes |
Instructs processor not to load Rouge. Also set if processor fails to load Rouge. |
|
|
No |
Yes |
Specifies source code highlighter. Any other value is permitted, but must be supported by a custom syntax highlighter adapter. |
|
integer |
No |
No |
Normalize block indentation in source code listings. |
|
source code language name |
No |
No |
|
|
empty |
No |
No |
Turns on line numbers for source code listings. |
HTML styling attributes
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
empty |
Yes |
Yes |
Copy CSS files to output.
Only relevant when the |
|
valid XML ID |
No |
Yes |
Assign value to |
|
empty |
No |
Yes |
Links to stylesheet instead of embedding it. Can’t be unset in SECURE mode. |
|
CSS length (e.g. 55em, 12cm, etc) |
No |
Yes |
Constrains maximum width of document body. Not recommended. Use CSS stylesheet instead. |
|
directory path |
Yes |
Yes |
Location of CSS stylesheets. |
|
empty |
Yes |
Yes |
CSS stylesheet file name. An empty value tells the converter to use the default stylesheet. |
|
valid CSS class name |
No |
Yes |
CSS class on the table of contents container. |
Manpage attributes
The attribute in this section are only relevant when using the manpage doctype and/or backend.
Name | Allowable Values | Set By Default | Header Only | Notes |
---|---|---|---|---|
|
any |
Based on content. |
Yes |
Metadata for man page output. |
|
any |
Based on content. |
Yes |
Metadata for man page output. |
|
any |
Based on content. |
Yes |
Metadata for man page output. |
|
any |
Based on content |
Yes |
Metadata for man page output. |
|
link format pattern |
No |
Yes |
Link style in man page output. |
|
any |
No |
Yes |
Source (e.g., application and version) the man page describes. |
|
any |
No |
Yes |
Manual name displayed in the man page footer. |
Security attributes
Since these attributes deal with security, they can only be set from the API or CLI.
Name | Allowable Values | Set By Default | API/CLI Only | Notes |
---|---|---|---|---|
|
empty |
No |
Yes |
Allows data to be read from URLs. |
|
integer (≥ 0) |
If safe mode is SECURE |
Yes |
Limits maximum size (in bytes) of a resolved attribute value. Default value is only set in SECURE mode. Since attributes can reference attributes, it’s possible to create an output document disproportionately larger than the input document without this limit in place. |
|
integer (≥ 0) |
Yes |
Yes |
Curtail infinite include loops and to limit the opportunity to exploit nested includes to compound the size of the output document. |
[1] The -number
attributes are created and managed automatically by the AsciiDoc processor for numbered blocks.
They are only used if the corresponding -caption
attribute is set (e.g., listing-caption
) and the block has a title.
In Asciidoctor, setting the -number
attributes will influence the next number used for subsequent numbered blocks of that type.
However, you should not rely on this behavior as it is subject to change in future revisions of the language.