-
-
Notifications
You must be signed in to change notification settings - Fork 44
Add reference
field to LinkReference
, ImageReference
#23
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,14 +157,17 @@ Yields: | |
### `Code` | ||
|
||
`Code` ([`Text`][text]) occurs at block level (see | ||
[`InlineCode`][inlinecode] for code spans). `Code` sports a language | ||
tag (when using GitHub Flavoured Markdown fences with a flag, `null` | ||
otherwise). | ||
[`InlineCode`][inlinecode] for code spans). `Code` supports an | ||
info string and a language tag (when the line with the opening fence | ||
contains some text, it is stored as the info string, the first word | ||
following the fence is stored as the language tag, the rest of the | ||
line is stored as the info string, both are null if missing) | ||
|
||
```idl | ||
interface Code <: Text { | ||
type: "code"; | ||
lang: string | null; | ||
info: string | null; | ||
} | ||
``` | ||
|
||
|
@@ -180,6 +183,7 @@ Yields: | |
{ | ||
"type": "code", | ||
"lang": null, | ||
"info": null, | ||
"value": "foo()" | ||
} | ||
``` | ||
|
@@ -719,10 +723,16 @@ 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]`). | ||
|
||
`reference` provides the original raw reference, if the `referenceType` is | ||
`full` and the reference differs from the `identifier`. This enables | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to drop the case where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it could be useful for linting, or non-HTML and non-markdown outputs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two thoughts:
As to usefulness, this comment was not meant to be an exhaustive list. I did provide a patch for remark-stringify, so this new property is arguably useful in the generation of markdown (i.e., not just the consumption). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
compilers and transformers to accurately reconstruct the original input | ||
as a fallback for unresolved references. | ||
|
||
```idl | ||
interface LinkReference <: Parent { | ||
type: "linkReference"; | ||
identifier: string; | ||
reference: string; | ||
referenceType: referenceType; | ||
} | ||
``` | ||
|
@@ -736,7 +746,7 @@ enum referenceType { | |
For example, the following markdown: | ||
|
||
```md | ||
[alpha][bravo] | ||
[alpha][Bravo] | ||
``` | ||
|
||
Yields: | ||
|
@@ -745,6 +755,7 @@ Yields: | |
{ | ||
"type": "linkReference", | ||
"identifier": "bravo", | ||
"reference": "Bravo", | ||
"referenceType": "full", | ||
"children": [{ | ||
"type": "text", | ||
|
@@ -763,10 +774,14 @@ its `url` and `title` defined somewhere else in the document by a | |
reference (`![foo][]`) or just unescaped brackets (`![foo]`). | ||
See [`LinkReference`][linkreference] for the definition of `referenceType`. | ||
|
||
`reference` provides the original raw reference. | ||
See [`LinkReference`][linkreference] for the definition of `reference`. | ||
|
||
```idl | ||
interface ImageReference <: Node { | ||
type: "imageReference"; | ||
identifier: string; | ||
reference: string; | ||
referenceType: referenceType; | ||
alt: string | null; | ||
} | ||
|
@@ -775,7 +790,7 @@ interface ImageReference <: Node { | |
For example, the following markdown: | ||
|
||
```md | ||
![alpha][bravo] | ||
![alpha][Bravo] | ||
``` | ||
|
||
Yields: | ||
|
@@ -784,6 +799,7 @@ Yields: | |
{ | ||
"type": "imageReference", | ||
"identifier": "bravo", | ||
"reference": "Bravo", | ||
"referenceType": "full", | ||
"alt": "alpha" | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.