Skip to content

Commit dbb1ede

Browse files
committed
Add label to Association
This change adds support for a new optional field on the association mixin, used by `definition`, `footnoteDefinition`, the `Reference` mixin (in turn used by `linkReference`, `imageReference`, and `footnoteReference`). The value of the `label` field must, when present, hold the non-normalised value of the `identifier` field. This allows references that are not association with definitions to be represented correctly as raw text again. Closes GH-23. Related to syntax-tree/mdast-util-to-hast#20 Related to syntax-tree/mdast-util-to-hast#21 Related to syntax-tree/mdast-util-to-hast#22 Related to remarkjs/remark#346
1 parent 525c2cb commit dbb1ede

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

readme.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ It has no content model.
608608
For example, the following markdown:
609609

610610
```markdown
611-
[alpha]: http://example.com
611+
[Alpha]: http://example.com
612612
```
613613

614614
Yields:
@@ -617,6 +617,7 @@ Yields:
617617
{
618618
type: 'definition',
619619
identifier: 'alpha',
620+
label: 'Alpha',
620621
url: 'http://example.com',
621622
title: null
622623
}
@@ -658,6 +659,7 @@ Yields:
658659
{
659660
type: 'footnoteDefinition',
660661
identifier: 'alpha',
662+
label: 'alpha',
661663
children: [{
662664
type: 'paragraph',
663665
children: [{type: 'text', value: 'bravo and charlie.'}]
@@ -967,7 +969,7 @@ Its content model is [**static phrasing**][dfn-static-phrasing-content] content.
967969
For example, the following markdown:
968970

969971
```markdown
970-
[alpha][bravo]
972+
[alpha][Bravo]
971973
```
972974

973975
Yields:
@@ -976,6 +978,7 @@ Yields:
976978
{
977979
type: 'linkReference',
978980
identifier: 'bravo',
981+
label: 'Bravo',
979982
referenceType: 'full',
980983
children: [{type: 'text', value: 'alpha'}]
981984
}
@@ -1016,6 +1019,7 @@ Yields:
10161019
{
10171020
type: 'imageReference',
10181021
identifier: 'bravo',
1022+
label: 'bravo',
10191023
referenceType: 'full',
10201024
alt: 'alpha'
10211025
}
@@ -1085,7 +1089,8 @@ Yields:
10851089
```javascript
10861090
{
10871091
type: 'footnoteReference',
1088-
identifier: 'alpha'
1092+
identifier: 'alpha',
1093+
label: 'alpha'
10891094
}
10901095
```
10911096

@@ -1114,6 +1119,7 @@ appropriate for a tooltip.
11141119
```idl
11151120
interface mixin Association {
11161121
identifier: string;
1122+
label: string?;
11171123
}
11181124
```
11191125

@@ -1122,6 +1128,9 @@ interface mixin Association {
11221128
An `identifier` field must be present.
11231129
It can match an `identifier` field on another node.
11241130

1131+
A `label` field can be present.
1132+
It represents the original value of the normalised `identifier` field.
1133+
11251134
Whether the value of `identifier` is expected to be a unique identifier or not
11261135
depends on the type of node including the **Association**.
11271136
An example of this is that `identifier` on [**Definition**][dfn-definition]

0 commit comments

Comments
 (0)