From 8453ad9a7bfd71258906a6296b23071f8bbbfc7d Mon Sep 17 00:00:00 2001 From: "@che" Date: Wed, 1 Aug 2018 04:30:09 +0200 Subject: [PATCH 1/3] Update description of Code (#22) * Update description of Code * infoString => info --- readme.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index eccd106..d4b16fa 100644 --- a/readme.md +++ b/readme.md @@ -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()" } ``` From eedeacadea6041d3e849cfa045984583c52ba93f Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Wed, 8 Aug 2018 13:05:52 -0400 Subject: [PATCH 2/3] Add reference property to LinkReference and ImageReference interfaces. --- readme.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index d4b16fa..0d2b8e7 100644 --- a/readme.md +++ b/readme.md @@ -723,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 +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; } ``` @@ -740,7 +746,7 @@ enum referenceType { For example, the following markdown: ```md -[alpha][bravo] +[alpha][Bravo] ``` Yields: @@ -749,6 +755,7 @@ Yields: { "type": "linkReference", "identifier": "bravo", + "reference": "Bravo", "referenceType": "full", "children": [{ "type": "text", @@ -767,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; } @@ -779,7 +790,7 @@ interface ImageReference <: Node { For example, the following markdown: ```md -![alpha][bravo] +![alpha][Bravo] ``` Yields: @@ -788,6 +799,7 @@ Yields: { "type": "imageReference", "identifier": "bravo", + "reference": "Bravo", "referenceType": "full", "alt": "alpha" } From 7825abef9147adf719704f89cab64aa1e275ee4b Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Fri, 17 Aug 2018 10:00:30 -0400 Subject: [PATCH 3/3] make all `identifiers` capture a raw form if it differs from the identifier. This either takes the form of a `reference` or a `definition` property. --- readme.md | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index 0d2b8e7..fccf15f 100644 --- a/readme.md +++ b/readme.md @@ -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]`). -`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 { @@ -815,13 +814,14 @@ 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: @@ -829,7 +829,8 @@ Yields: ```json { "type": "footnoteReference", - "identifier": "alpha" + "identifier": "Alpha" + "reference": "alpha" } ``` @@ -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; } @@ -851,7 +857,7 @@ interface Definition <: Node { For example, the following markdown: ```md -[alpha]: http://example.com +[Alpha]: http://example.com ``` Yields: @@ -860,6 +866,7 @@ Yields: { "type": "definition", "identifier": "alpha", + "definition": "Alpha", "title": null, "url": "http://example.com" } @@ -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";