Include an Example
An example can be inserted into any page or partial in your site using the AsciiDoc include directive and the example’s resource ID.
Example 1 shows the structure of an include directive with a example’s fully qualified resource ID.
Let’s break down the AsciiDoc syntax and resource ID coordinates you need to include a example resource into a page.
The steps below assume that the target example and current page belong to the same component version and module, so only the family (example$) and resource coordinates of the target example resource are entered in the resource ID.
On a new line, enter the name of the directive followed by two colons,
Enter the resource ID of the target example file, making sure to specify the
By default, the include directive assumes the family coordinate is
page$when the coordinate isn’t specified. If you forget to use the
example$coordinate, Antora will report an error because it won’t be able to find your example.
Complete the directive with a set of square brackets (
The brackets can contain an optional list of attributes. The attributes are entered as key-value pairs separated by commas.
Antora supports filtering the lines of an example file by either line numbers using the
lines attribute or tags using the
Filtering by line numbers takes precedence.
See the AsciiDoc include directive documentation for full details about the
When the target example file and the current page belong to the same module, you only need to enter the family and resource coordinates in the resource ID.
When the target example file and current page belong to different modules of the same component version, enter the example’s module, family, and resource coordinates in the resource ID.
When the target example file and the current page belong to different docs components, enter the example’s version, component, module, family, and resource coordinates in the resource ID.
Don’t specify the version coordinate if you want the page to always reference the latest version of the example.