3.0.0-dev
The main application interface (API) for Asciidoctor. This API provides methods to parse AsciiDoc content and convert it to various output formats using built-in or third-party converters.
An AsciiDoc document can be as simple as a single line of content, though it more commonly starts with a document header that declares the document title and document attribute definitions. The document header is then followed by zero or more section titles, optionally nested, to organize the paragraphs, blocks, lists, etc. of the document.
By default, the processor converts the AsciiDoc document to HTML 5 using a built-in converter. However, this behavior can be changed by specifying a different backend (e.g., +docbook+). A backend is a keyword for an output format (e.g., DocBook). That keyword, in turn, is used to select a converter, which carries out the request to convert the document to that format.
asciidoctor.convertFile('document.adoc', { 'safe': 'safe' }) // Convert an AsciiDoc file
asciidoctor.convert("I'm using *Asciidoctor* version {asciidoctor-version}.", { 'safe': 'safe' }) // Convert an AsciiDoc string
const doc = asciidoctor.loadFile('document.adoc', { 'safe': 'safe' }) // Parse an AsciiDoc file into a document object
const doc = asciidoctor.load("= Document Title\n\nfirst paragraph\n\nsecond paragraph", { 'safe': 'safe' }) // Parse an AsciiDoc string into a document object
Parse the AsciiDoc source input into an Document and convert it to the specified backend format.
Accepts input as a Buffer or String.
(Object)
a JSON of options to control processing (default: {})
(string | Document)
:
the
Document
object if the converted String is written to a file,
otherwise the converted String
const input = `= Hello, AsciiDoc!
Guillaume Grossetie <ggrossetie@example.com>
An introduction to http://asciidoc.org[AsciiDoc].
== First Section
* item 1
* item 2`
const html = asciidoctor.convert(input)
Parse the AsciiDoc source input into an Document and convert it to the specified backend format.
(string)
source filename
(Object)
a JSON of options to control processing (default: {})
(string | Document)
:
the
Document
object if the converted String is written to a file,
otherwise the converted String
const html = asciidoctor.convertFile('./document.adoc')
Extends AbstractNode
Append a block to this block's list of child blocks.
(AbstractBlock)
the block to append
AbstractBlock
:
the parent block to which this block was appended.
Get the String title of this Block with title substitions applied
The following substitutions are applied to block and section titles:
specialcharacters, quotes, replacements, macros, attributes and post_replacements
string
:
the converted String title for this Block, or undefined if the title is not set.
block.title // "Foo 3^ # {two-colons} Bar(1)"
block.getTitle(); // "Foo 3^ # :: Bar(1)"
Remove the specified substitution keyword from the list of substitutions for this block.
(any)
Checks if the AbstractBlock contains any child blocks.
boolean
:
whether the
AbstractBlock
has child blocks.
Get the list of AbstractBlock sub-blocks for this block.
Array<AbstractBlock>
:
a list of
AbstractBlock
sub-blocks
Query for all descendant block-level nodes in the document tree that match the specified selector (context, style, id, and/or role). If a function block is given, it's used as an additional filter. If no selector or function block is supplied, all block-level nodes in the tree are returned.
Array<AbstractBlock>
:
a list of block-level nodes that match the filter or an empty list if no matches are found
doc.findBy({'context': 'section'});
// => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 }
// => { level: 1, title: "First Section", blocks: 1 }
doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; });
// => { level: 1, title: "First Section", blocks: 1 }
doc.findBy({'context': 'listing', 'style': 'source'});
// => { context: :listing, content_model: :verbatim, style: "source", lines: 1 }
Get the numeral of this block (if section, relative to parent, otherwise absolute). Only assigned to section if automatic section numbering is enabled. Only assigned to formal block (block with title) if corresponding caption attribute is present. If the section is an appendix, the numeral is a letter (starting with A).
string
:
the numeral
Methods for managing sections of AsciiDoc content in a document.
Extends AbstractBlock
<pre>
section = asciidoctor.Section.create()
section.setTitle('Section 1')
section.setId('sect1')
section.getBlocks().length // 0
section.getId() // "sect1"
section.append(newBlock)
section.getBlocks().length // 1
</pre>
Create a {Section} object.
(AbstractBlock?)
The parent AbstractBlock. If set, must be a Document or Section object (default: undefined)
(number?)
The Integer level of this section (default: 1 more than parent level or 1 if parent not defined)
(boolean?)
A Boolean indicating whether numbering is enabled for this Section (default: false)
(Object?)
An optional JSON of options (default: {})
Section
:
a new {Section} object
Get the name of the Section (title)
string
:
Methods for managing AsciiDoc content blocks.
Extends AbstractBlock
block = asciidoctor.Block.create(parent, 'paragraph', {source: '_This_ is a <test>'})
block.getContent()
// "<em>This</em> is a <test>"
Create a {Block} object.
(AbstractBlock)
The parent {AbstractBlock} with a compound content model to which this {Block} will be appended.
(string)
The context name for the type of content (e.g., "paragraph").
(Object?)
a JSON of options to customize block initialization: (default: {})
Name | Description |
---|---|
opts.content_model string
|
indicates whether blocks can be nested in this {Block} ("compound"), otherwise how the lines should be processed ("simple", "verbatim", "raw", "empty"). (default: "simple") |
opts.attributes Object
|
a JSON of attributes (key/value pairs) to assign to this {Block}. (default: {}) |
opts.source (string | Array<string>)
|
a String or {Array} of raw source for this {Block}. (default: undefined)
IMPORTANT: If you don't specify the |
Block
:
a new {Block} object
An abstract base class that provides state and methods for managing a node of AsciiDoc content. The state and methods on this class are common to all content segments in an AsciiDoc document.
Apply the specified substitutions to the text. If no substitutions are specified, the following substitutions are applied: specialcharacters, quotes, attributes, replacements, macros, and post_replacements.
(string | Array<string>)
:
a String or String Array to match the type of the text argument with substitutions applied.
Resolve the list of comma-delimited subs against the possible options.
(string)
The comma-delimited String of substitution names or aliases.
(string?)
A String representing the context for which the subs are being resolved (default: 'block').
(string?)
The String to use in log messages to communicate the subject for which subs are being resolved (default: undefined)
Array<string>
:
An Array of Strings representing the substitution operation or nothing if no subs are found.
Get the value of the specified attribute. If the attribute is not found on this node, fallback_name is set, and this node is not the Document node, get the value of the specified attribute from the Document node.
Look for the specified attribute in the attributes on this node and return the value of the attribute, if found. Otherwise, if fallback_name is set (default: same as name) and this node is not the Document node, look for that attribute on the Document node and return its value, if found. Otherwise, return the default value (default: undefined).
(string)
The String of the attribute to resolve.
(any?)
The {Object} value to return if the attribute is not found (default: undefined).
(string?)
The String of the attribute to resolve on the Document if the attribute is not found on this node (default: same as name).
any
:
the {Object} value (typically a String) of the attribute or defaultValue if the attribute is not found.
Check if the specified attribute is defined using the same logic as {AbstractNode#getAttribute}, optionally performing acomparison with the expected value if specified.
Look for the specified attribute in the attributes on this node. If not found, fallback_name is specified (default: same as name), and this node is not the Document node, look for that attribute on the Document node. In either case, if the attribute is found, and the comparison value is truthy, return whether the two values match. Otherwise, return whether the attribute was found.
(string)
The String name of the attribute to resolve.
(any?)
The expected Object value of the attribute (default: undefined).
(string)
The String of the attribute to resolve on the Document if the attribute is not found on this node (default: same as name).
boolean
:
a Boolean indicating whether the attribute exists and, if a truthy comparison value is specified, whether the value of the attribute matches the comparison value.
Assign the value to the attribute name for the current node.
(string)
The String attribute name to assign
(any)
The Object value to assign to the attribute (default: '')
(boolean)
A Boolean indicating whether to assign the attribute if currently present in the attributes JSON (default: true)
boolean
:
a Boolean indicating whether the assignment was performed
Get the AbstractNode to which this node is attached.
AbstractNode
:
the
AbstractNode
object to which this node is attached,
or undefined if this node has no parent.
Checks if the role attribute is set on this node and, if an expected value is given, whether the space-separated role matches that value.
(string)
The expected String value of the role (optional, default: undefined)
boolean
:
a Boolean indicating whether the role attribute is set on this node and, if an expected value is given, whether the space-separated role matches that value.
Sets the value of the role attribute on this node.
string
:
the value of the role attribute
A convenience method to check if the specified option attribute is enabled on the current node. Check if the option is enabled. This method simply checks to see if the -option attribute is defined on the current node.
(string)
the String name of the option
boolean
:
a Boolean indicating whether the option has been specified
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Read the contents of the file at the specified path. This method assumes that the path is safe to read. It checks that the file is readable before attempting to read it.
(any)
the {string} path from which to read the contents
(Object)
a JSON {Object} of options to control processing (default: {})
Name | Description |
---|---|
options.warn_on_failure boolean
|
a {boolean} that controls whether a warning is issued if the file cannot be read (default: false) |
options.normalize boolean
|
a {boolean} that controls whether the lines are normalized and coerced to UTF-8 (default: false) |
string
:
the String content of the file at the specified path, or undefined if the file does not exist.
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Call AbstractNode#resolveSubstitutions for the 'block' type.
(any)
(any)
(any)
Call AbstractNode#resolveSubstitutions for the 'inline' type with the subject set as passthrough macro.
(any)
The Document class represents a parsed AsciiDoc document.
Document is the root node of a parsed AsciiDoc document. It provides an abstract syntax tree (AST) that represents the structure of the AsciiDoc document from which the Document object was parsed.
Although the constructor can be used to create an empty document object, more commonly, you'll load the document object from AsciiDoc source using the primary API methods on Asciidoctor. When using one of these APIs, you almost always want to set the safe mode to 'safe' (or 'unsafe') to enable all of Asciidoctor's features.
Instances of this class can be used to extract information from the document or alter its structure. As such, the Document object is most often used in extensions and by integrations.
The most basic usage of the Document object is to retrieve the document's title.
You can also use the Document object to access document attributes defined in the header, such as the author and doctype.
Extends AbstractBlock
(any)
(any)
(any)
Convert the AsciiDoc document using the templates loaded by the Converter. If a "template_dir" is not specified, or a template is missing, the converter will fall back to using the appropriate built-in template.
(Object?)
a JSON of options to control processing (default: {})
string
:
Write the output to the specified file.
If the converter responds to "write", delegate the work of writing the file to that method. Otherwise, write the output the specified file.
Get the title explicitly defined in the document attributes.
string
:
Set the title on the document header
Set the title of the document header to the specified value. If the header does not exist, it is first created.
(string)
the String title to assign as the title of the document header
string
:
the new String title assigned to the document header
(any)
Document/Title
:
a
Document/Title
Assign a value to the specified attribute in the document header.
The assignment will be visible when the header attributes are restored, typically between processor phases (e.g., between parse and convert).
(string)
The {string} attribute name to assign
(Object)
The {Object} value to assign to the attribute (default: '')
(boolean)
A {boolean} indicating whether to assign the attribute
if already present in the attributes Hash (default: true)
boolean
:
true if the assignment was performed otherwise false
Document/RevisionInfo
:
a
Document/RevisionInfo
Replay attribute assignments at the block level.
This method belongs to an internal API that deals with how attributes are managed by the processor. If you understand why this group of methods are necessary, and what they do, feel free to use them. However, keep in mind they are subject to change at any time.
(Object)
A JSON of attributes
Delete the specified attribute from the document if the name is not locked. If the attribute is locked, false is returned. Otherwise, the attribute is deleted.
(string)
the String attribute name
boolean
:
true if the attribute was deleted, false if it was not because it's locked
Restore the attributes to the previously saved state (attributes in header).
Parse the AsciiDoc source stored in the {Reader} into an abstract syntax tree.
If the data parameter is not nil, create a new {PreprocessorReader} and assigned it to the reader property of this object. Otherwise, continue with the reader that was created when the {Document} was instantiated. Pass the reader to {Parser.parse} to parse the source data into an abstract syntax tree.
If parsing has already been performed, this method returns without performing any processing.
Document
:
this {Document}
(any)
(any)
A read-only integer value indicating the level of security that should be enforced while processing this document. The value must be set in the Document constructor using the "safe" option.
A value of 0 (UNSAFE) disables any of the security features enforced by Asciidoctor.
A value of 1 (SAFE) closely parallels safe mode in AsciiDoc. In particular, it prevents access to files which reside outside of the parent directory of the source file and disables any macro other than the include directive.
A value of 10 (SERVER) disallows the document from setting attributes that would affect the conversion of the document, in addition to all the security features of SafeMode.SAFE. For instance, this level forbids changing the backend or source-highlighter using an attribute defined in the source document header. This is the most fundamental level of security for server deployments (hence the name).
A value of 20 (SECURE) disallows the document from attempting to read files from the file system and including the contents of them into the document, in addition to all the security features of SafeMode.SECURE. In particular, it disallows use of the include::[] directive and the embedding of binary content (data uri), stylesheets and JavaScripts referenced by the document. (Asciidoctor and trusted extensions may still be allowed to embed trusted content into the document).
Since Asciidoctor is aiming for wide adoption, 20 (SECURE) is the default value and is recommended for server deployments.
A value of 100 (PARANOID) is planned to disallow the use of passthrough macros and prevents the document from setting any known attributes, in addition to all the security features of SafeMode.SECURE. Please note that this level is not currently implemented (and therefore not enforced)!
number
:
An integer value indicating the level of security
Get the Boolean AsciiDoc compatibility mode. Enabling this attribute activates the following syntax changes:
boolean
:
Get the activated {Extensions.Registry} associated with this document.
Extensions/Registry
:
The Author class represents information about an author extracted from document attributes.
Maintains a catalog of callouts and their associations.
Register a new callout for the given list item ordinal. Generates a unique id for this callout based on the index of the next callout list in the document and the index of this callout since the end of the last callout list.
(number)
the Integer ordinal (1-based) of the list item to which this callout is to be associated
string
:
The unique String id of this callout
callouts = asciidoctor.Callouts.create()
callouts.register(1)
// => "CO1-1"
callouts.nextList()
callouts.register(2)
// => "CO2-1"
Get the next callout index in the document.
Reads the next callout index in the document and advances the pointer. This method is used during conversion to retrieve the unique id of the callout that was generated during parsing.
string
:
The unique String id of the next callout in the document
Advance to the next callout list in the document.
Rewind the list index pointer, intended to be used when switching from the parsing to conversion phase.
A partitioned title (i.e., title & subtitle).
Methods for managing inline elements in AsciiDoc block.
Extends AbstractNode
Methods for managing AsciiDoc lists (ordered, unordered and description lists).
Extends AbstractBlock
Methods for managing items for AsciiDoc olists, ulist, and dlists.
In a description list (dlist), each item is a tuple that consists of a 2-item Array of ListItem terms and a ListItem description (i.e., [[term, term, ...], desc]. If a description is not set, then the second entry in the tuple is nil.
Extends AbstractBlock
Push source onto the front of the reader and switch the context based on the file, document-relative path and line information given.
This method is typically used in an IncludeProcessor to add source read from the target specified.
Reader
:
this {Reader} object.
Check whether there are any lines left to read. If a previous call to this method resulted in a value of false, immediately returned the cached value. Otherwise, delegate to peekLine to determine if there is a next line available.
boolean
:
true if there are more lines, false if there are not.
Peek at the next line. Processes the line if not already marked as processed, but does not consume it (ie. you will be able to read this line again).
This method will probe the reader for more lines. If there is a next line that has not previously been visited, the line is passed to the Reader#processLine method to be initialized. This call gives sub-classes the opportunity to do preprocessing. If the return value of the Reader#processLine is undefined, the data is assumed to be changed and Reader#peekLine is invoked again to perform further processing.
If hasMoreLines is called immediately before peekLine, the direct flag is implicitly true (since the line is flagged as visited).
(boolean)
A {boolean} flag to bypasses the check for more lines and immediately returns the first element of the internal lines {Array}. (default: false)
string
:
the next line as a {string} if there are lines remaining.
Consume, preprocess, and return the remaining lines.
This method calls Reader#readLine repeatedly until all lines are consumed and returns the lines as an {Array} of {string}. This method differs from Reader#getLines in that it processes each line in turn, hence triggering any preprocessors implemented in sub-classes.
Lines will be consumed from the Reader (ie. you won't be able to read these lines again).
Array<string>
:
the lines read as an {Array} of {string}.
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Create a new MemoryLogger.
MemoryLogger
:
a MemoryLogger
LoggerFormatter
:
the formatter
(LoggerFormatter)
the formatter
Create a new NullLogger.
NullLogger
:
a NullLogger
This API is experimental and subject to change.
A pluggable adapter for integrating a syntax (aka code) highlighter into AsciiDoc processing.
There are two types of syntax highlighter adapters. The first performs syntax highlighting during the convert phase. This adapter type must define a "handlesHighlighting" method that returns true. The companion "highlight" method will then be called to handle the "specialcharacters" substitution for source blocks.
The second assumes syntax highlighting is performed on the client (e.g., when the HTML document is loaded). This adapter type must define a "hasDocinfo" method that returns true. The companion "docinfo" method will then be called to insert markup into the output document. The docinfo functionality is available to both adapter types.
Asciidoctor.js provides several a built-in adapter for highlight.js. Additional adapters can be registered using SyntaxHighlighter.register.
This API is experimental and subject to change.
This API is experimental and subject to change.
(string)
The {string} name of the syntax highlighter to retrieve.
SyntaxHighlighter
:
the {SyntaxHighlighter} registered for this name.
Methods for managing AsciiDoc tables.
Extends AbstractBlock
Create a new Table element.
(AbstractBlock)
Table
:
a new {Table} object
Get the rows of this table.
Table.Rows
:
an {Table.Rows} object with the members "head", "body" and "foot"
Retrieve the rows grouped by section as a nested Array.
Creates a 2-dimensional array of two element entries. The first element is the section name as a string. The second element is the Array of rows in that section. The entries are in document order (head, foot, body).
[[string, array<array<Cell>>], [string, array<array<Cell>>], [string, array<array<Cell>>]]
:
Methods to manage the columns of an AsciiDoc table. In particular, it keeps track of the column specs.
Extends AbstractNode
Methods for managing the cells in an AsciiDoc table.
Extends AbstractBlock
This API is experimental and subject to change.
Please note that this API is currently only available in a Node environment. We recommend to use a custom converter if you are running in the browser.
Create a new TemplateConverter.
(string)
the backend name
(any)
a list of template directories
(Object)
a JSON of options
Name | Description |
---|---|
opts.template_engine string
|
the name of the template engine |
opts.template_cache Object?
|
an optional template cache |
opts.template_cache.scans Object?
|
a JSON of template objects keyed by template name keyed by path patterns |
opts.template_cache.templates Object?
|
a JSON of template objects keyed by file paths |
TemplateConverter
:
Clear the global cache.
Convert an {AbstractNode} to the backend format using the named template.
Looks for a template that matches the value of the template name or, if the template name is not specified, the value of the {@see AbstractNode.getNodeName} function.
(AbstractNode)
the AbstractNode to convert
(string)
the {string} name of the template to use, or the node name of the node if a template name is not specified. (optional, default: undefined)
(Object)
an optional JSON that is passed as local variables to the template. (optional, default: undefined)
string
:
The {string} result from rendering the template
This API is experimental and subject to change.
Please note that this API is currently only available in a Node environment. We recommend to use a custom converter if you are running in the browser.
A pluggable adapter for integrating a template engine into the built-in template converter.
Register a template engine adapter for the given names.
(Object)
a template engine adapter instance
const fs = require('fs')
class DotTemplateEngineAdapter {
constructor () {
this.doT = require('dot')
}
compile (file, _) {
const templateFn = this.doT.template(fs.readFileSync(file, 'utf8'))
return {
render: templateFn
}
}
}
asciidoctor.TemplateEngine.register('dot, new DotTemplateEngineAdapter())
Extensions provide a way to participate in the parsing and converting phases of the AsciiDoc processor or extend the AsciiDoc syntax.
The various extensions participate in AsciiDoc processing as follows:
Extensions may be registered globally using the {Extensions.register} method or added to a custom {Registry} instance and passed as an option to a single Asciidoctor processor.
asciidoctor.Extensions.register(function () {
this.block(function () {
const self = this
self.named('shout')
self.onContext('paragraph')
self.process(function (parent, reader) {
const lines = reader.getLines().map(function (l) { return l.toUpperCase(); })
return self.createBlock(parent, 'paragraph', lines)
})
})
})
Create a new Extensions/Registry.
Extensions/Registry
:
returns a
Extensions/Registry
(any)
(any)
Get statically-registered extension groups.
Unregister all statically-registered extension groups.
Unregister the specified statically-registered extension groups.
NOTE Opal cannot delete an entry from a Hash that is indexed by symbol, so we have to resort to using low-level operations in this method.
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
this API is experimental and subject to change
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Checks whether any {Extensions/Preprocessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/Preprocessor
} extensions are registered.
Checks whether any {Extensions/TreeProcessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/TreeProcessor
} extensions are registered.
Checks whether any {Extensions/IncludeProcessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/IncludeProcessor
} extensions are registered.
Checks whether any {Extensions/Postprocessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/Postprocessor
} extensions are registered.
Checks whether any {Extensions/DocinfoProcessor} extensions have been registered.
(any)
A {string} for selecting docinfo extensions at a given location (head or footer) (default: undefined)
any
:
a {boolean} indicating whether any {
Extensions/DocinfoProcessor
} extensions are registered.
Checks whether any {Extensions/BlockProcessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/BlockProcessor
} extensions are registered.
Checks whether any {Extensions/BlockMacroProcessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/BlockMacroProcessor
} extensions are registered.
Checks whether any {Extensions/InlineMacroProcessor} extensions have been registered.
any
:
a {boolean} indicating whether any {
Extensions/InlineMacroProcessor
} extensions are registered.
Retrieves the Extension proxy objects for all the {Extensions/Preprocessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/TreeProcessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/IncludeProcessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/Postprocessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/DocinfoProcessor} instances stored in this registry.
(any)
A {string} for selecting docinfo extensions at a given location (head or footer) (default: undefined)
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/BlockProcessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/BlockMacroProcessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Retrieves the Extension proxy objects for all the {Extensions/InlineMacroProcessor} instances stored in this registry.
any
:
an {array} of Extension proxy objects.
Get any {Extensions/InlineMacroProcessor} extensions are registered to handle the specified inline macro name.
(any)
the {string} inline macro name
any
:
the Extension proxy object for the {
Extensions/InlineMacroProcessor
} that matches the inline macro name or undefined if no match is found.
Get any {Extensions/BlockProcessor} extensions are registered to handle the specified block name appearing on the specified context.
(any)
the {string} block name
(any)
the context of the block: paragraph, open... (optional)
any
:
the Extension proxy object for the {
Extensions/BlockProcessor
} that matches the block name and context or undefined if no match is found.
Get any {Extensions/BlockMacroProcessor} extensions are registered to handle the specified macro name.
(any)
the {string} macro name
any
:
the Extension proxy object for the {
Extensions/BlockMacroProcessor
} that matches the macro name or undefined if no match is found.
The extension will be added to the beginning of the list for that extension type. (default is append).
(any)
Creates a list block node and links it to the specified parent.
(any)
The parent Block (Block, Section, or Document) of this new list block.
(string)
The list context (e.g., ulist, olist, colist, dlist)
(Object)
An object of attributes to set on this list block
List
:
Creates an image block node and links it to the specified parent.
(Object)
A JSON of attributes
Name | Description |
---|---|
attrs.target string
|
the target attribute to set the source of the image. |
attrs.alt string
|
the alt attribute to specify an alternative text for the image. |
(Object)
A JSON of options
Block
:
Parses blocks in the content and attaches the block to the parent.
(AbstractBlock)
the parent block
AbstractNode
:
The parent node into which the blocks are parsed.
Parses the attrlist String into a JSON of attributes
(AbstractBlock)
the current AbstractBlock or the parent AbstractBlock if there is no current block (used for applying subs)
(string)
the list of attributes as a String
any
:
a JSON of parsed attributes
Get the configuration JSON for this processor instance.
(any)
(any)
Convert the specified node.
(AbstractNode)
the AbstractNode to convert
(string)
an optional String transform that hints at
which transformation should be applied to this node.
(Object)
a JSON of options that provide additional hints about how to convert the node (default: {})
any
:
the {Object} result of the conversion, typically a {string}.
Register a custom converter in the global converter factory to handle conversion to the specified backends. If the backend value is an asterisk, the converter is used to handle any backend that does not have an explicit converter.
(any)
The Converter instance to register
(any)
{Array} - A {string} {Array} of backend names that this converter should be registered to handle (optional, default: ['*'])
any
:
Returns nothing
Retrieves the singleton instance of the converter factory.
(boolean)
instantiate the singleton if it has not yet
been instantiated. If this value is false and the singleton has not yet been
instantiated, this method returns a fresh instance.
Converter/Factory
:
an instance of the converter factory.
Get the converter registry.
any
:
the registry of converter instances or classes keyed by backend name
Create a new Html5Converter.
Html5Converter
:
a Html5Converter
Converts an {AbstractNode} using the given transform. This method must be implemented by a concrete converter class.
(AbstractNode)
The concrete instance of AbstractNode to convert.
(string?)
An optional String transform that hints at which transformation should be applied to this node.
If a transform is not given, the transform is often derived from the value of the {AbstractNode#getNodeName} property. (optional, default: undefined)
(Object?)
An optional JSON of options hints about how to convert the node. (optional, default: undefined)
string
:
the String result.