1.5.5-5
Methods for parsing AsciiDoc input files and converting documents.
AsciiDoc documents comprise a header followed by zero or more sections. Sections are composed of blocks of content. For example:
= Doc Title == Section 1 This is a paragraph block in the first section. == Section 2 This section has a paragraph block and an olist block. . Item 1 . Item 2
asciidoctor.convertFile('sample.adoc');
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)
:
returns the
Document
object if the converted String is written to a file,
otherwise the converted String
var input = '= Hello, AsciiDoc!\n' +
'Guillaume Grossetie <ggrossetie@example.com>\n\n' +
'An introduction to http://asciidoc.org[AsciiDoc].\n\n' +
'== First Section\n\n' +
'* item 1\n' +
'* item 2\n';
var 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)
:
returns the
Document
object if the converted String is written to a file,
otherwise the converted String
var html = asciidoctor.convertFile('./document.adoc');
Extends AbstractNode
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
:
returns the converted String title for this Block, or an empty string if the assigned title is falsy
block.title // "Foo 3^ # {two-colons} Bar(1)"
block.getTitle(); // "Foo 3^ # :: Bar(1)"
Get the list of AbstractBlock sub-blocks for this block.
Array
:
returns 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
:
returns 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 }
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Extends AbstractBlock
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Document/Title
:
returns a
Document/Title
(any)
Get the document catalog Hash.
Get the document revision date from document header (document attribute revdate
).
Get the document revision number from document header (document attribute revnumber
).
Get the document revision remark from document header (document attribute revremark
).
Document/RevisionInfo
:
returns a
Document/RevisionInfo
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Get the document revision date from document header (document attribute revdate
).
Get the document revision number from document header (document attribute revnumber
).
Get the document revision remark from document header (document attribute revremark
).
A short summary of changes in this document revision.
Extends AbstractNode
(any)
(any)
(any)
(any)
(any)
Get the current location of the reader's cursor, which encapsulates the file, dir, path, and lineno of the file being read.
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.
Opal.Asciidoctor.Extensions.register(function () {
this.block(function () {
var self = this;
self.named('shout');
self.onContext('paragraph');
self.process(function (parent, reader) {
var lines = reader.$lines().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)
Unregister all statically-registered extension groups.
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)