From 8570e84b5012fcc5bab249664d1a30520276497f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20P=C3=A4per?= Date: Sun, 17 Mar 2019 19:28:13 +0100 Subject: [PATCH] introduce heading IDs --- spec.txt | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) 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