From 14f6fb8462d6f030d3df774560fd3771556847b5 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 1 Jul 2020 17:57:40 +0200 Subject: add annotated examples to link reference definitions --- spec.txt | 371 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 371 insertions(+) diff --git a/spec.txt b/spec.txt index 14c8d65..36459b0 100644 --- a/spec.txt +++ b/spec.txt @@ -3194,6 +3194,50 @@ them. ```````````````````````````````` +[Link reference definition] with [annotation hint]: + +```````````````````````````````` example +[foo]: /url {.ex:hint} "title" + +[foo] +. +

foo

+```````````````````````````````` + + +```````````````````````````````` example + [foo]: + /url + {ex:hint} + 'the title' + +[foo] +. +

foo

+```````````````````````````````` + + +```````````````````````````````` example +[Foo*bar\]]:my_(url) {=ex:hint} 'title (with parens)' + +[Foo*bar\]] +. +

Foo*bar]

+```````````````````````````````` + + +```````````````````````````````` example +[Foo bar]: + +{.} +'title' + +[Foo bar] +. +

Foo bar

+```````````````````````````````` + + The title may extend over multiple lines: ```````````````````````````````` example @@ -3228,6 +3272,35 @@ with blank line' ```````````````````````````````` +The annotation may extend over multiple lines: + +```````````````````````````````` example +[foo]: /url { +.ex:first +=ex:second +} + +[foo] +. +

foo

+```````````````````````````````` + + +However, it may not contain a [blank line]: + +```````````````````````````````` example +[foo]: /url {.ex:hint + +=ex:hint_after_blank_line} + +[foo] +. +

[foo]: /url {.ex:hint

+

=ex:hint_after_blank_line}

+

[foo]

+```````````````````````````````` + + The title may be omitted: ```````````````````````````````` example @@ -3262,6 +3335,41 @@ The link destination may not be omitted:

foo

```````````````````````````````` +The link destination may be omitted +when an annotation is included: + +```````````````````````````````` example +[foo]: {.ex:hint} + +[foo] +. +

foo

+```````````````````````````````` + + +An empty [annotation destination] may be specified +using angle brackets: + +```````````````````````````````` example +[foo]: {<>} + +[foo] +. +

foo

+```````````````````````````````` + +An empty [annotation destination] as CURIE is not allowed, however: + +```````````````````````````````` example +[foo]: {.} + +[foo] +. +

[foo]: {.}

+

[foo]

+```````````````````````````````` + + The title must be separated from the link destination by spaces or tabs: @@ -3275,6 +3383,28 @@ spaces or tabs: ```````````````````````````````` +The annotation must be separated from the link destination by +spaces or tabs + +```````````````````````````````` example +[foo]: {.ex:hint} + +[foo] +. +

[foo]: bar

+

[foo]

+```````````````````````````````` + +```````````````````````````````` example +[foo]: /bar{.ex:hint} + +[foo] +. +

[foo]: /bar{.ex:hint}

+

[foo]

+```````````````````````````````` + + Both title and destination can contain backslash escapes and literal backslashes: @@ -3287,6 +3417,30 @@ and literal backslashes: ```````````````````````````````` +Annotation can contain backslash escapes +in angle brackets: + +```````````````````````````````` example +[foo]: /url\bar\*baz {.} + +[foo] +. +

foo

+```````````````````````````````` + +Annotation cannot contain backslash escapes +in CURIE form, however: + +```````````````````````````````` example +[foo]: /url\bar\*baz {.ex:foo\"bar\baz} + +[foo] +. +

[foo]: /url\bar\*baz {.ex:foo\"bar\baz}

+

[foo]

+```````````````````````````````` + + A link can come before its corresponding definition: ```````````````````````````````` example @@ -3297,6 +3451,16 @@ A link can come before its corresponding definition:

foo

```````````````````````````````` +```````````````````````````````` example +[foo] + +[foo]: url {.ex:hint} +. +

foo

+```````````````````````````````` + + + If there are several matching definitions, the first one takes precedence: @@ -3310,6 +3474,54 @@ precedence:

foo

```````````````````````````````` +```````````````````````````````` example +[foo] + +[foo]: url {.ex:first} +[foo]: url {.ex:second} +. +

foo

+```````````````````````````````` + +```````````````````````````````` example +[foo] + +[foo]: url {.ex:first} +[foo]: url {=ex:second} +. +

foo

+```````````````````````````````` + +```````````````````````````````` example +[foo]: url {.ex:first} + +[foo] + +[foo]: url {=ex:second} +. +

foo

+```````````````````````````````` + +```````````````````````````````` example +[foo] + +[foo]: url {} + +[foo]: url {=ex:second} +. +

foo

+```````````````````````````````` + +```````````````````````````````` example +[foo] + +[foo]: url + +[foo]: url {=ex:second} +. +

foo

+```````````````````````````````` + As noted in the section on [Links], matching of labels is case-insensitive (see [matches]). @@ -3322,6 +3534,13 @@ case-insensitive (see [matches]).

Foo

```````````````````````````````` +```````````````````````````````` example +[FOO]: /url {.ex:hint} + +[Foo] +. +

Foo

+```````````````````````````````` ```````````````````````````````` example [ΑΓΩ]: /φου @@ -3331,6 +3550,14 @@ case-insensitive (see [matches]).

αγω

```````````````````````````````` +```````````````````````````````` example +[ΑΓΩ]: /φου {.φου:φου φου:φου =φου:φου .<φου> <φου> =<φου>} + +[αγω] +. +

αγω

+```````````````````````````````` + Here is a link reference definition with no corresponding link. It contributes nothing to the document. @@ -3353,6 +3580,26 @@ bar ```````````````````````````````` +Here are some with annotation: + +```````````````````````````````` example +[foo]: /url {.ex:hint} +. +```````````````````````````````` + +```````````````````````````````` example +[ +foo +]: /url +{ +.ex:hint +} +bar +. +

bar

+```````````````````````````````` + + This is not a link reference definition, because there are characters other than spaces or tabs after the title: @@ -3361,6 +3608,22 @@ characters other than spaces or tabs after the title: .

[foo]: /url "title" ok

```````````````````````````````` +Here is a bogus annotated one with stuff after title: + +```````````````````````````````` example +[foo]: /url {.ex:hint} "title" ok +. +

[foo]: /url {.ex:hint} "title" ok

+```````````````````````````````` + +This is not a link reference definition, +because there are characters other than spaces or tabs or title after annotation: + +```````````````````````````````` example +[foo]: /url {.ex:hint} ok +. +

[foo]: /url {.ex:hint} ok

+```````````````````````````````` This is a link reference definition, but it has no title: @@ -3372,6 +3635,16 @@ This is a link reference definition, but it has no title:

"title" ok

```````````````````````````````` +Here is an annotated link reference definition, without title: + +```````````````````````````````` example +[foo]: /url {.ex:hint} +"title" ok +. +

"title" ok

+```````````````````````````````` + + This is not a link reference definition, because it is indented four spaces: @@ -3385,6 +3658,17 @@ four spaces:

[foo]

```````````````````````````````` +Here is a bogus one indented four spaces, with annotation: + +```````````````````````````````` example + [foo]: /url {.ex:hint} "title" + +[foo] +. +
[foo]: /url {.ex:hint} "title"
+
+

[foo]

+```````````````````````````````` This is not a link reference definition, because it occurs inside @@ -3402,6 +3686,21 @@ a code block:

[foo]

```````````````````````````````` +Here is an annotated bogus link reference definition in code block: + +```````````````````````````````` example +``` +[foo]: /url {.ex:hint} +``` + +[foo] +. +
[foo]: /url {.ex:hint}
+
+

[foo]

+```````````````````````````````` + + A [link reference definition] cannot interrupt a paragraph. @@ -3416,6 +3715,17 @@ Foo

[bar]

```````````````````````````````` +```````````````````````````````` example +Foo +[bar]: /baz {.ex:hint} + +[bar] +. +

Foo +[bar]: /baz {.ex:hint}

+

[bar]

+```````````````````````````````` + However, it can directly follow other block elements, such as headings and thematic breaks, and it need not be followed by a blank line. @@ -3431,6 +3741,17 @@ and thematic breaks, and it need not be followed by a blank line. ```````````````````````````````` +```````````````````````````````` example +# [Foo] +[foo]: /url {.ex:hint} +> bar +. +

Foo

+
+

bar

+
+```````````````````````````````` + ```````````````````````````````` example [foo]: /url bar @@ -3441,6 +3762,16 @@ bar

foo

```````````````````````````````` +```````````````````````````````` example +[foo]: /url {.ex:hint} +bar +=== +[foo] +. +

bar

+

foo

+```````````````````````````````` + ```````````````````````````````` example [foo]: /url === @@ -3450,6 +3781,15 @@ bar foo

```````````````````````````````` +```````````````````````````````` example +[foo]: /url {.ex:hint} +=== +[foo] +. +

=== +foo

+```````````````````````````````` + Several [link reference definitions] can occur one after another, without intervening blank lines. @@ -3469,6 +3809,22 @@ can occur one after another, without intervening blank lines. baz

```````````````````````````````` +```````````````````````````````` example +[foo]: /foo-url {.ex:first} "foo" +[bar]: /bar-url +{.ex:second} + "bar" +[baz]: /baz-url {.ex:third} + +[foo], +[bar], +[baz] +. +

foo, +bar, +baz

+```````````````````````````````` + [Link reference definitions] can occur inside block containers, like lists and block quotations. They @@ -3485,6 +3841,16 @@ are defined: ```````````````````````````````` +```````````````````````````````` example +[foo] + +> [foo]: /url {.ex:hint} +. +

foo

+
+
+```````````````````````````````` + Whether something is a [link reference definition] is independent of whether the link reference it defines is @@ -3497,6 +3863,11 @@ no visible content: . ```````````````````````````````` +```````````````````````````````` example +[foo]: /url {.ex:hint} +. +```````````````````````````````` + ## Annotation reference definitions -- cgit v1.2.3