11/**
22 * @typedef {import('mdast').FootnoteReference } FootnoteReference
33 * @typedef {import('mdast').FootnoteDefinition } FootnoteDefinition
4+ * @typedef {import('mdast-util-from-markdown').CompileContext } CompileContext
45 * @typedef {import('mdast-util-from-markdown').Extension } FromMarkdownExtension
56 * @typedef {import('mdast-util-from-markdown').Handle } FromMarkdownHandle
67 * @typedef {import('mdast-util-to-markdown').Options } ToMarkdownExtension
@@ -34,20 +35,29 @@ export function gfmFootnoteFromMarkdown() {
3435 }
3536 }
3637
37- /** @type {FromMarkdownHandle } */
38+ /**
39+ * @this {CompileContext}
40+ * @type {FromMarkdownHandle }
41+ */
3842 function enterFootnoteDefinition ( token ) {
3943 this . enter (
4044 { type : 'footnoteDefinition' , identifier : '' , label : '' , children : [ ] } ,
4145 token
4246 )
4347 }
4448
45- /** @type {FromMarkdownHandle } */
49+ /**
50+ * @this {CompileContext}
51+ * @type {FromMarkdownHandle }
52+ */
4653 function enterFootnoteDefinitionLabelString ( ) {
4754 this . buffer ( )
4855 }
4956
50- /** @type {FromMarkdownHandle } */
57+ /**
58+ * @this {CompileContext}
59+ * @type {FromMarkdownHandle }
60+ */
5161 function exitFootnoteDefinitionLabelString ( token ) {
5262 const label = this . resume ( )
5363 const node = /** @type {FootnoteDefinition } */ (
@@ -59,22 +69,34 @@ export function gfmFootnoteFromMarkdown() {
5969 ) . toLowerCase ( )
6070 }
6171
62- /** @type {FromMarkdownHandle } */
72+ /**
73+ * @this {CompileContext}
74+ * @type {FromMarkdownHandle }
75+ */
6376 function exitFootnoteDefinition ( token ) {
6477 this . exit ( token )
6578 }
6679
67- /** @type {FromMarkdownHandle } */
80+ /**
81+ * @this {CompileContext}
82+ * @type {FromMarkdownHandle }
83+ */
6884 function enterFootnoteCall ( token ) {
6985 this . enter ( { type : 'footnoteReference' , identifier : '' , label : '' } , token )
7086 }
7187
72- /** @type {FromMarkdownHandle } */
88+ /**
89+ * @this {CompileContext}
90+ * @type {FromMarkdownHandle }
91+ */
7392 function enterFootnoteCallString ( ) {
7493 this . buffer ( )
7594 }
7695
77- /** @type {FromMarkdownHandle } */
96+ /**
97+ * @this {CompileContext}
98+ * @type {FromMarkdownHandle }
99+ */
78100 function exitFootnoteCallString ( token ) {
79101 const label = this . resume ( )
80102 const node = /** @type {FootnoteDefinition } */ (
@@ -86,7 +108,10 @@ export function gfmFootnoteFromMarkdown() {
86108 ) . toLowerCase ( )
87109 }
88110
89- /** @type {FromMarkdownHandle } */
111+ /**
112+ * @this {CompileContext}
113+ * @type {FromMarkdownHandle }
114+ */
90115 function exitFootnoteCall ( token ) {
91116 this . exit ( token )
92117 }
@@ -111,6 +136,7 @@ export function gfmFootnoteToMarkdown() {
111136 function footnoteReference ( node , _ , context , safeOptions ) {
112137 const tracker = track ( safeOptions )
113138 let value = tracker . move ( '[^' )
139+ // @ts -expect-error: use map.
114140 const exit = context . enter ( 'footnoteReference' )
115141 const subexit = context . enter ( 'reference' )
116142 value += tracker . move (
@@ -138,6 +164,7 @@ export function gfmFootnoteToMarkdown() {
138164 function footnoteDefinition ( node , _ , context , safeOptions ) {
139165 const tracker = track ( safeOptions )
140166 let value = tracker . move ( '[^' )
167+ // @ts -expect-error: use map.
141168 const exit = context . enter ( 'footnoteDefinition' )
142169 const subexit = context . enter ( 'label' )
143170 value += tracker . move (
0 commit comments