Headings can be assigned attributes using this syntax at the end of the line containing the heading text:
{#identifier .class .class key=value key=value}
Thus, for example, the following headings will all be assigned the identifier foo
:
# My heading {#foo}
## My heading ## {#foo}
My other heading {#foo}
---------------
(This syntax is compatible with PHP Markdown Extra.)
Note that although this syntax allows assignment of classes and key/value attributes, writers generally don’t use all of this information. Identifiers, classes, and key/value attributes are used in HTML and HTML-based formats such as EPUB and slidy. Identifiers are used for labels and link anchors in the LaTeX, ConTeXt, Textile, Jira markup, and AsciiDoc writers.
Headings with the class unnumbered
will not be numbered, even if --number-sections
is specified. A single hyphen (-
) in an attribute context is equivalent to .unnumbered
, and preferable in non-English documents. So,
# My heading {-}
is just the same as
# My heading {.unnumbered}