Include Examples and Partials
Examples are non-AsciiDoc files that contain reusable content, such as source code or programmatic output, that is often inserted into code blocks. They’re saved in the examples directory of a module. Regardless of an example’s source module, it can be inserted into any standard page in your documentation site using the include directive and the example file’s resource ID.
Partials are AsciiDoc files that contain reusable snippets of content. They’re saved in the partials directory of a module. Regardless of a partial’s source module, it can be inserted into any standard page in your documentation site using the include directive and the partial file’s resource ID.
An entire example or partial (or a portion of) is inserted into a page using the include directive and file’s resource ID.
A resource ID is just like a page ID, but it has an extra coordinate,
The family coordinate for examples is
partial$ for partials.
Like the page ID in an xref, the more a page and the partial or example are related, the less coordinates you have to specify.
To include a snippet of content from an example or partial (instead of the whole file), use the
This page discusses how to develop Couchbase applications to function in times of node or network failure. // tag::failover-definition (1) (2) -- Failover is the means by which a node is removed from the cluster and all its owned vBuckets are immediately: * Transferred to a replica node (if there are replica nodes) * Marked offline (if there are no replica nodes). -- // end::failover-definition (3) (4)
|1||To indicate the start of a tagged region, insert a comment line (
|2||Assign a unique name to the region in the
|3||Insert a comment line where you want the tagged region to end.|
|4||Assign the name of the region you want to terminate to the
To insert a tagged region into a page, enter the resource ID and tag attribute in the include directive.
If you received this error message, you might have a failover condition. include::6.0@sdk-common:shared:partial$env-errors.adoc[tag=failover-definition]
Code regions in example files can be tagged using the language’s comment syntax before
For example, if you tag code in a YAML file, place a hash (
#) before the tag directive.
# tag::expire artifacts: expire_in: 1 week # end::expire paths: - public/
To call out a section of a page as Developer Preview, use the
Otherwise if the whole page is Developer Preview content, you can use the page-status attribute.
This is a Developer Preview feature, intended for development purposes only. Do not use this feature in production. No Enterprise Support is provided for Developer Preview features.
Browse the source files in the SDK language and common components on GitHub for numerous examples of partial includes and tagging.
The Antora and Asciidoctor documentation provide more information about including partials, examples, and standard pages as well as optional attributes such as