Skip to content

Commit

Permalink
Add label to Association
Browse files Browse the repository at this point in the history
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
  • Loading branch information
wooorm committed Aug 31, 2018
1 parent 525c2cb commit dbb1ede
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ It has no content model.
For example, the following markdown:

```markdown
[alpha]: http://example.com
[Alpha]: http://example.com
```

Yields:
Expand All @@ -617,6 +617,7 @@ Yields:
{
type: 'definition',
identifier: 'alpha',
label: 'Alpha',
url: 'http://example.com',
title: null
}
Expand Down Expand Up @@ -658,6 +659,7 @@ Yields:
{
type: 'footnoteDefinition',
identifier: 'alpha',
label: 'alpha',
children: [{
type: 'paragraph',
children: [{type: 'text', value: 'bravo and charlie.'}]
Expand Down Expand Up @@ -967,7 +969,7 @@ Its content model is [**static phrasing**][dfn-static-phrasing-content] content.
For example, the following markdown:

```markdown
[alpha][bravo]
[alpha][Bravo]
```

Yields:
Expand All @@ -976,6 +978,7 @@ Yields:
{
type: 'linkReference',
identifier: 'bravo',
label: 'Bravo',
referenceType: 'full',
children: [{type: 'text', value: 'alpha'}]
}
Expand Down Expand Up @@ -1016,6 +1019,7 @@ Yields:
{
type: 'imageReference',
identifier: 'bravo',
label: 'bravo',
referenceType: 'full',
alt: 'alpha'
}
Expand Down Expand Up @@ -1085,7 +1089,8 @@ Yields:
```javascript
{
type: 'footnoteReference',
identifier: 'alpha'
identifier: 'alpha',
label: 'alpha'
}
```

Expand Down Expand Up @@ -1114,6 +1119,7 @@ appropriate for a tooltip.
```idl
interface mixin Association {
identifier: string;
label: string?;
}
```

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

A `label` field can be present.
It represents the original value of the normalised `identifier` field.

Whether the value of `identifier` is expected to be a unique identifier or not
depends on the type of node including the **Association**.
An example of this is that `identifier` on [**Definition**][dfn-definition]
Expand Down

0 comments on commit dbb1ede

Please sign in to comment.