1919* [ API] ( #api )
2020 * [ ` gfmFootnoteFromMarkdown() ` ] ( #gfmfootnotefrommarkdown )
2121 * [ ` gfmFootnoteToMarkdown() ` ] ( #gfmfootnotetomarkdown )
22+ * [ HTML] ( #html )
23+ * [ Syntax] ( #syntax )
2224* [ Syntax tree] ( #syntax-tree )
2325 * [ Nodes] ( #nodes )
2426 * [ Content model] ( #content-model )
3032
3133## What is this?
3234
33- This package contains extensions that add support for the footnote syntax
34- enabled by GFM to [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] and
35- [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
35+ This package contains two extensions that add support for GFM footnote syntax
36+ in markdown to [ mdast] [ ] .
37+ These extensions plug into
38+ [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] (to support parsing
39+ footnotes in markdown into a syntax tree) and
40+ [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] (to support serializing
41+ footnotes in syntax trees to markdown).
3642
3743GFM footnotes were [ announced September 30, 2021] [ post ] but are not specified.
3844Their implementation on github.com is currently buggy.
3945The bugs have been reported on [ ` cmark-gfm ` ] [ cmark-gfm ] .
4046
4147## When to use this
4248
43- These tools are all rather low-level.
44- In most cases, you’d want to use [ ` remark-gfm ` ] [ remark-gfm ] with remark instead.
49+ You can use these extensions when you are working with
50+ ` mdast-util-from-markdown ` and ` mdast-util-to-markdown ` already.
51+
52+ When working with ` mdast-util-from-markdown ` , you must combine this package
53+ with [ ` micromark-extension-gfm-footnote ` ] [ micromark-extension-gfm-footnote ] .
54+
55+ When you don’t need a syntax tree, you can use [ ` micromark ` ] [ micromark ]
56+ directly with ` micromark-extension-gfm-footnote ` .
4557
4658When you are working with syntax trees and want all of GFM, use
4759[ ` mdast-util-gfm ` ] [ mdast-util-gfm ] instead.
4860
49- When working with ` mdast-util-from-markdown ` , you must combine this package with
50- [ ` micromark-extension-gfm-footnote ` ] [ extension ] .
61+ All these packages are used [ ` remark-gfm ` ] [ remark-gfm ] , which
62+ focusses on making it easier to transform content by abstracting these
63+ internals away.
5164
5265This utility does not handle how markdown is turned to HTML.
5366That’s done by [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
@@ -56,7 +69,7 @@ If your content is not in English, you should configure that utility.
5669## Install
5770
5871This package is [ ESM only] [ esm ] .
59- In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm] [ ] :
72+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
6073
6174``` sh
6275npm install mdast-util-gfm-footnote
@@ -142,19 +155,42 @@ Hi\![^1]
142155
143156## API
144157
145- This package exports the identifiers ` gfmFootnoteFromMarkdown ` and
146- ` gfmFootnoteToMarkdown ` .
158+ This package exports the identifiers
159+ [ ` gfmFootnoteFromMarkdown ` ] [ api-gfmfootnotefrommarkdown ] and
160+ [ ` gfmFootnoteToMarkdown ` ] [ api-gfmfootnotetomarkdown ] .
147161There is no default export.
148162
149163### ` gfmFootnoteFromMarkdown() `
150164
151- Function that can be called to get an extension for
152- [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] .
165+ Create an extension for
166+ [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ]
167+ to enable GFM footnotes in markdown.
168+
169+ ###### Returns
170+
171+ Extension for ` mdast-util-from-markdown `
172+ ([ ` FromMarkdownExtension ` ] [ frommarkdownextension ] ).
153173
154174### ` gfmFootnoteToMarkdown() `
155175
156- Function that can be called to get an extension for
157- [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
176+ Create an extension for
177+ [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ]
178+ to enable GFM footnotes in markdown.
179+
180+ ###### Returns
181+
182+ Extension for ` mdast-util-to-markdown `
183+ ([ ` ToMarkdownExtension ` ] [ tomarkdownextension ] ).
184+
185+ ## HTML
186+
187+ This utility does not handle how markdown is turned to HTML.
188+ That’s done by [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
189+ If your content is not in English, you should configure that utility.
190+
191+ ## Syntax
192+
193+ See [ Syntax in ` micromark-extension-frontmatter ` ] [ syntax ] .
158194
159195## Syntax tree
160196
@@ -166,25 +202,25 @@ The following interfaces are added to **[mdast][]** by this utility.
166202
167203``` idl
168204interface FootnoteDefinition <: Parent {
169- type: " footnoteDefinition"
205+ type: ' footnoteDefinition'
170206 children: [FlowContent]
171207}
172208
173209FootnoteDefinition includes Association
174210```
175211
176- ** FootnoteDefinition** ([ ** Parent** ] [ dfn-parent ] ) represents content relating
212+ ** FootnoteDefinition** (** [ Parent] [ dfn-parent ] ** ) represents content relating
177213to the document that is outside its flow.
178214
179- ** FootnoteDefinition** can be used where [ ** flow** ] [ dfn-flow-content ] content is
180- expected.
181- Its content model is also [ ** flow** ] [ dfn-flow-content ] content.
215+ ** FootnoteDefinition** can be used where ** [ flow] [ dfn-flow-content ] ** content
216+ is expected.
217+ Its content model is also ** [ flow] [ dfn-flow-content ] ** content.
182218
183219** FootnoteDefinition** includes the mixin
184- [ ** Association** ] [ dfn-mxn-association ] .
220+ ** [ Association] [ dfn-mxn-association ] ** .
185221
186222** FootnoteDefinition** should be associated with
187- [ ** FootnoteReferences** ] [ dfn-footnote-reference ] .
223+ ** [ FootnoteReferences] [ dfn-footnote-reference ] ** .
188224
189225For example, the following markdown:
190226
@@ -210,23 +246,23 @@ Yields:
210246
211247``` idl
212248interface FootnoteReference <: Node {
213- type: " footnoteReference"
249+ type: ' footnoteReference'
214250}
215251
216252FootnoteReference includes Association
217253```
218254
219- ** FootnoteReference** ([ ** Node** ] [ dfn-node ] ) represents a marker through
255+ ** FootnoteReference** (** [ Node] [ dfn-node ] ** ) represents a marker through
220256association.
221257
222258** FootnoteReference** can be used where
223- [ ** static phrasing** ] [ dfn-static-phrasing-content ] content is expected.
259+ ** [ static phrasing] [ dfn-static-phrasing-content ] ** content is expected.
224260It has no content model.
225261
226- ** FootnoteReference** includes the mixin [ ** Association** ] [ dfn-mxn-association ] .
262+ ** FootnoteReference** includes the mixin ** [ Association] [ dfn-mxn-association ] ** .
227263
228264** FootnoteReference** should be associated with a
229- [ ** FootnoteDefinition** ] [ dfn-footnote-definition ] .
265+ ** [ FootnoteDefinition] [ dfn-footnote-definition ] ** .
230266
231267For example, the following markdown:
232268
@@ -255,36 +291,35 @@ type FlowContentGfm = FootnoteDefinition | FlowContent
255291#### ` StaticPhrasingContent ` (GFM footnotes)
256292
257293``` idl
258- type StaticPhrasingContentGfm =
259- FootnoteReference | StaticPhrasingContent
294+ type StaticPhrasingContentGfm = FootnoteReference | StaticPhrasingContent
260295```
261296
262297## Types
263298
264299This package is fully typed with [ TypeScript] [ ] .
265300It does not export additional types.
266301
267- The ` FootnoteDefinition ` and ` FootnoteReference ` node types are supported in
268- ` @types/mdast ` by default .
302+ The ` FootnoteDefinition ` and ` FootnoteReference ` types of the mdast nodes are
303+ exposed from ` @types/mdast ` .
269304
270305## Compatibility
271306
272307Projects maintained by the unified collective are compatible with all maintained
273308versions of Node.js.
274- As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
309+ As of now, that is Node.js 14.14+ and 16.0+.
275310Our projects sometimes work with older versions, but this is not guaranteed.
276311
277312This plugin works with ` mdast-util-from-markdown ` version 1+ and
278313` mdast-util-to-markdown ` version 1+.
279314
280315## Related
281316
282- * [ ` remarkjs/ remark-gfm` ] [ remark-gfm ]
317+ * [ ` remark-gfm ` ] [ remark-gfm ]
283318 — remark plugin to support GFM
284- * [ ` syntax-tree/ mdast-util-gfm` ] [ mdast-util-gfm ]
319+ * [ ` mdast-util-gfm ` ] [ mdast-util-gfm ]
285320 — same but all of GFM (autolink literals, footnotes, strikethrough, tables,
286321 tasklists)
287- * [ ` micromark/micromark -extension-gfm-footnote ` ] [ extension ]
322+ * [ ` micromark-extension-gfm-footnote ` ] [ micromark- extension-gfm-footnote ]
288323 — micromark extension to parse GFM footnotes
289324
290325## Contribute
@@ -355,7 +390,11 @@ abide by its terms.
355390
356391[ remark-gfm ] : https://github.com/remarkjs/remark-gfm
357392
358- [ extension ] : https://github.com/micromark/micromark-extension-gfm-footnote
393+ [ micromark ] : https://github.com/micromark/micromark
394+
395+ [ micromark-extension-gfm-footnote ] : https://github.com/micromark/micromark-extension-gfm-footnote
396+
397+ [ syntax ] : https://github.com/micromark/micromark-extension-gfm-footnote#syntax
359398
360399[ gfm ] : https://github.github.com/gfm/
361400
@@ -375,10 +414,18 @@ abide by its terms.
375414
376415[ dfn-node ] : https://github.com/syntax-tree/unist#node
377416
417+ [ frommarkdownextension ] : https://github.com/syntax-tree/mdast-util-from-markdown#extension
418+
419+ [ tomarkdownextension ] : https://github.com/syntax-tree/mdast-util-to-markdown#options
420+
378421[ dfn-flow-content ] : #flowcontent-gfm-footnotes
379422
380423[ dfn-static-phrasing-content ] : #staticphrasingcontent-gfm-footnotes
381424
382425[ dfn-footnote-reference ] : #footnotereference
383426
384427[ dfn-footnote-definition ] : #footnotedefinition
428+
429+ [ api-gfmfootnotefrommarkdown ] : #gfmfootnotefrommarkdown
430+
431+ [ api-gfmfootnotetomarkdown ] : #gfmfootnotetomarkdown
0 commit comments