Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reference field to LinkReference, ImageReference #23

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,9 @@ its `url` and `title` defined somewhere else in the document by a
`referenceType` is needed to detect if a reference was meant as a
reference (`[foo][]`) or just unescaped brackets (`[foo]`).

wooorm marked this conversation as resolved.
Show resolved Hide resolved
`reference` provides the original raw reference, if the `referenceType` is
`full` and the reference differs from the `identifier`. This enables
compilers and transformers to accurately reconstruct the original input
as a fallback for unresolved references.
`reference` provides the original raw reference, if the `reference` differs
from the `identifier`. This enables compilers, transformers, and linters to
accurately reconstruct the original input.

```idl
interface LinkReference <: Parent {
Expand Down Expand Up @@ -815,21 +814,23 @@ but its content is already outside the documents flow: placed in a
interface FootnoteReference <: Node {
type: "footnoteReference";
identifier: string;
reference: string;
}
```

For example, the following markdown:

```md
[^alpha]
[^Alpha]
```

Yields:

```json
{
"type": "footnoteReference",
"identifier": "alpha"
"identifier": "Alpha"
wooorm marked this conversation as resolved.
Show resolved Hide resolved
"reference": "alpha"
}
```

Expand All @@ -839,10 +840,15 @@ Yields:
and title) of a [`LinkReference`][linkreference] or an
[`ImageReference`][imagereference].

`definition` provides the original raw definition, if the `definition` differs
from the `identifier`. This enables compilers, transformers, and linters to
accurately reconstruct the original input.

```idl
interface Definition <: Node {
type: "definition";
identifier: string;
definition: string;
title: string | null;
url: string;
}
Expand All @@ -851,7 +857,7 @@ interface Definition <: Node {
For example, the following markdown:

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

Yields:
Expand All @@ -860,6 +866,7 @@ Yields:
{
"type": "definition",
"identifier": "alpha",
"definition": "Alpha",
wooorm marked this conversation as resolved.
Show resolved Hide resolved
"title": null,
"url": "http://example.com"
}
Expand All @@ -870,6 +877,10 @@ Yields:
`FootnoteDefinition` ([`Parent`][parent]) represents the definition
(i.e., content) of a [`FootnoteReference`][footnotereference].

`definition` provides the original raw definition.
See [`Definition`][definition] for the definition of `definition`.


```idl
interface FootnoteDefinition <: Parent {
type: "footnoteDefinition";
Expand Down