diff --git a/readme.md b/readme.md index eccd106..fccf15f 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()" } ``` @@ -719,10 +723,15 @@ 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 `reference` differs +from the `identifier`. This enables compilers, transformers, and linters to +accurately reconstruct the original input. + ```idl interface LinkReference <: Parent { type: "linkReference"; identifier: string; + reference: string; referenceType: referenceType; } ``` @@ -736,7 +745,7 @@ enum referenceType { For example, the following markdown: ```md -[alpha][bravo] +[alpha][Bravo] ``` Yields: @@ -745,6 +754,7 @@ Yields: { "type": "linkReference", "identifier": "bravo", + "reference": "Bravo", "referenceType": "full", "children": [{ "type": "text", @@ -763,10 +773,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 +789,7 @@ interface ImageReference <: Node { For example, the following markdown: ```md -![alpha][bravo] +![alpha][Bravo] ``` Yields: @@ -784,6 +798,7 @@ Yields: { "type": "imageReference", "identifier": "bravo", + "reference": "Bravo", "referenceType": "full", "alt": "alpha" } @@ -799,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: @@ -813,7 +829,8 @@ Yields: ```json { "type": "footnoteReference", - "identifier": "alpha" + "identifier": "Alpha" + "reference": "alpha" } ``` @@ -823,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; } @@ -835,7 +857,7 @@ interface Definition <: Node { For example, the following markdown: ```md -[alpha]: http://example.com +[Alpha]: http://example.com ``` Yields: @@ -844,6 +866,7 @@ Yields: { "type": "definition", "identifier": "alpha", + "definition": "Alpha", "title": null, "url": "http://example.com" } @@ -854,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";