With Asciidoctor we can create numbered lists easily. When we want to change the number the list starts with we use the
start attribute when we define the list.
Document attributes are like variables for your Asciidoctor document. Normally when we reference an attribute that is not set in our Asciidoctor markup the reference is still in the output. This is very handy, because we immediately see that a document attribute is not set. But we can customize this behavior with the document attribute
attribute-missing. We can use the default value
skip, which leaves the reference in the output. Another option is
drop, which means the reference is dropped from the output. Finally we can set the value to
drop-line, where the complete line with the attribute reference is dropped from the output.
In our Asciidoc markup we can include delimited blocks, like sidebars, examples, listings and admonitions. A delimited block is indicated by a balanced pair of delimiter characters. For example a sidebar starts and ends with four asterisk characters (
****). If we want to nest another delimited block of the same type we must add an extra delimiter character at the start and end of the nested block. So when we want to nest another sidebar block inside an existing sidebar block we must use five asterisk characters (
With Asciidoctor we can repeat cell contents if we prefix the cell separator pipe symbol (
|) with the number of times we want to repeat the cell followed by an asterisk (
When we transform our Asciidoc source files to HTML Asciidoctor will print the date and time the document was last updated in the footer. If we want to disable the Last updated text we disable the document attribute
Normally all Asciidoc files are processed and transformed to output files by Asciidoctor. But if we start the file name with an underscore (
_) the file is not transformed to an output file. This is very useful, because we can define some Asciidoc document fragments and include them in other Asciidoc files, but in the output directory the document fragment is not generated.
In a previous blog post we learned about the conditional directives in Asciidoctor. Dan Allen mentioned a conditional directive that we can use to see if the document is used on GitHub. The conditional directive is called
To use font icons from FontAwesome we set the document attribute
icons with the value
font. The default link to the CSS location is
https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css. We can change the location for the FontAwesome CSS with document attributes.
In Asciidoc markup we can include or exclude text based on the existence of document attributes or based on the value of a document attribute. Therefore we use the macros
ifeval. If we want to include some content if the document attribute sample is set we can use the following syntax:
ifdef::sample[Content is shown when sample attribute is set]
Content is shown when sample attribute is set
If we want to include some content if the attribute is not set we use
ifndef::sample[Content is shown when sample attribute is NOT set]
Content is shown when sample attribute is NOT set
In a previous post we learned how to include partial content from included files. We needed to enclose the content we want to include between start and end tags and reference those tags in our documentation markup. But Andres Almiray already mentioned in a tweet we can use line numbers as well: