diff --git a/spec.txt b/spec.txt index 91551e51..20842e7d 100644 --- a/spec.txt +++ b/spec.txt @@ -968,6 +968,55 @@ ATX headings can be empty:

```````````````````````````````` +### Heading identifiers + +Headings may be used to generate a table of contents (ToC). +Authors and readers commonly want to target links at headings. +Therefore, an implementation may choose to +add unique anchors to all headings +which are automatically generated from their textual content + +```````````````````````````````` example +# Foo +## Bar +## Baz +. +

Foo

+

Bar

+

Baz

+```````````````````````````````` + +If necessary to disambiguate, +the textual content of their ancestral headings can also be used. + +```````````````````````````````` example +# Foo +## Bar +# Quuz +## Bar +. +

Foo

+

Bar

+

Quuz

+

Baz

+```````````````````````````````` + +If that does not result in unique identifiers, +a counter may be added. + +```````````````````````````````` example +# Foo +# Foo +. +

Foo

+

Foo

+```````````````````````````````` + +The exact algorithm to generate the identifier is not mandated. +Implementations may choose to apply Unicode normalization, +case folding, white space collapsing, affix addition, +romanization, removal of diacritic marks etc. +as needed to conform to the requirements of the target language. ## Setext headings