6.11 Divs and Spans
Within Divs, need to escape dollar signs for currency symbols: \$. However, in regular body text, Quarto processes it automatically.
You can add classes, attributes, and other identifiers to regions of content using Divs and Spans.
- classes:
.class - identifiers:
#id - key-value attributes:
key="value"
Note that:
They are separated by spaces, do NOT use commas.
This is different from
bookdown, which uses commas.Order: identifiers, classes, and then key-value attributes.
Logical attributes:
true/false,yes/no, andon/offare all equivalent toTRUE/FALSEin R.It is optional to enclose in quotes.
6.11.1 Block Attributes
Apply attributes to a block of content, such as a paragraph, list, or code block.
Div example:
Once rendered to HTML, Quarto will translate the markdown into:
Note that:
The Div should be separated by blank lines from preceding and following blocks.
Fenced divs can be nested.
For example
will be rendered to
More examples
Headings with attributes
renders to:
List with attributes
renders to:
Paragrphs with attributes
renders to:
6.11.2 Inline Attributes
Apply attributes to inline text, such as selected words within a paragraph.
A bracketed sequence of inlines [text here] (as one would use to begin a link) will be treated as a <span> with attributes if it is followed immediately by attributes {attributes here}.
Syntax for inline attributes:
Once rendered to HTML, Quarto will translate the markdown into
Note that:
No space between
]and{.Ordering of attributes matter.
#idcomes first then.classthenkey="val".Any of these can be omitted, but must follow that order if they are provided.
Valid example:
Invalid example:
Use example:
renders to: