You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.5 KiB
35 lines
1.5 KiB
4 years ago
|
You can use the include directive to include the content of a list item from another file, but there are some things you need to be aware of.
|
||
|
|
||
|
Recall that the `include` directive must be defined on a line by itself.
|
||
|
This presents a challenge with lists since each list item must begin with the list marker.
|
||
|
We can solve this by using the built-in `blank` attribute to initiate the list item, then follow that line with the include directive to bring in the actual content.
|
||
|
|
||
|
Here's an example of how to use the `blank` attribute and the include directive to define a list item, then include the primary text from another file:
|
||
|
|
||
|
[source,asciidoc]
|
||
|
----
|
||
|
* {blank}
|
||
|
\include::item-text.adoc[]
|
||
|
----
|
||
|
|
||
|
This technique works well if you control the contents of the included file and can ensure it only contains adjacent lines of text.
|
||
|
If a list item does not contain adjacent lines, the list may be terminated.
|
||
|
So we need a bit more syntax.
|
||
|
|
||
|
If you can't guarantee that all the included lines will be adjacent, you'll want to tuck the include directive inside an open block.
|
||
|
This keeps all the include lines together, enclosed inside the boundaries of the block.
|
||
|
You then attach this block to the list item using a <<user-manual.adoc#list-continuation,list continuation>> (i.e., `+`).
|
||
|
|
||
|
Here's an example of how to include complex content from another file into a list item:
|
||
|
|
||
|
[source,asciidoc]
|
||
|
----
|
||
|
* {blank}
|
||
|
+
|
||
|
--
|
||
|
\include::complex-list-item.adoc[]
|
||
|
--
|
||
|
----
|
||
|
|
||
|
See <<user-manual.adoc##dropping-the-principal-text>> for another example of this technique.
|