Asciidoctor Remote Include Processor Extension
An extension for Asciidoctor.js that allows to include remote files in Antora.
1. Install
Install the dependencies:
$ npm install asciidoctor.js asciidoctor-remote-include-processor
2. Usage
2.1. Register as an Asciidoctor extension in the Antora playbook of your website
asciidoc:
extensions:
- "@feelpp/asciidoctor-remote-include-extension"
2.2. Include a remote file
In an Antora adoc page, include a remote file
[source,cpp]
----
#include
int main(int argc, char** argv )
{
// tag::hello[]
std::cout << "Hello World!" << std::endl;
// end::hello[]
}
----
which gives:
#include <iotream>
int main(int argc, char** argv )
{
// tag::hello[]
std::cout << "Hello World!" << std::endl;
// end::hello[]
}
2.3. Include a remote file partially using tags
In Asciidoctor we can include a source file partially using tags, see here. The extension enables this very feature.
[source,cpp]
----
std::cout << "Hello World!" << std::endl;
----
which gives:
std::cout << "Hello World!" << std::endl;
3. Acknowledgments
-
@Djenks on Gitter Antora/users for his many suggestions and explanations
-
@Mozgtter for asciidoctor-emoji which served as the template for this extension
and of course
-
@mojavelinux for the awesome work he does on Antora and Asciidoctor.