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.
 
 

95 lines
2.2 KiB

////
Included in:
- user-manual: Attributes: Style
////
// tag::intro[]
The style attribute is the first positional attribute in an attribute list.
It specifies a predefined set of characteristics that should apply to a block element or macro.
For example, a paragraph block can be assigned one of the following built-in style attributes:
* normal (default, so does not need to be set)
* literal
* verse
* quote
* listing
* TIP
* NOTE
* IMPORTANT
* WARNING
* CAUTION
* abstract
* partintro
* comment
* example
* sidebar
* source
// end::intro[]
==== Id
// tag::id[]
The id attribute specifies a unique name for an element.
That name can only be used once in a document.
An id has two purposes:
. to provide an internal link or cross reference anchor for the element
. to reference a style or script used by the output processor
// end::id[]
////
BlockId
NOTE: Section pending
////
===== Block assignment
// tag::bl[]
In an attribute list, there are two ways to assign an id attribute to a block element.
. Prefixing the name with a hash (`#`).
. Specifying the name with `id=<name>`.
[source]
----
[#goals]
* Goal 1
* Goal 2
----
Let's say you want to create a blockquote from an open block and assign it an ID and role.
You add `quote` (the block style) in front of the `#` (the ID) in the first attribute position, as this example shows:
[source]
----
[quote#roads, Dr. Emmett Brown]
____
Roads? Where we're going, we don't need roads.
____
----
TIP: The order of ID and role values in the shorthand syntax does not matter.
CAUTION: If the ID contains a `.`, you must define it using either a longhand assignment (e.g., `id=classname.propertyname`) or the anchor shorthand (e.g., `+[[classname.propertyname]]+`).
This is necessary since the `.` character in the shorthand syntax is the delimiter for a role, and thus gets misinterpreted as such.
// end::bl[]
===== Inline assignment
// tag::in[]
The id (`#`) shorthand can be used on inline quoted text.
.Quoted text block with id assignment using Asciidoctor shorthand
----
[#free_the_world]*free the world*
----
// end::in[]
////
.Quoted text block with `id` assignment using traditional AsciiDoc syntax
----
[[free_the_world]]*free the world*
----
////