diff --git a/lib/index.js b/lib/index.js index 1930f57..a456828 100644 --- a/lib/index.js +++ b/lib/index.js @@ -31,7 +31,13 @@ function enterFootnoteCallString() { * @type {FromMarkdownHandle} */ function enterFootnoteCall(token) { - this.enter({type: 'footnoteReference', identifier: '', label: ''}, token) + // Trailing `position: undefined` keeps the footnoteReference hidden class + // stable; mdast-util-from-markdown's enter() patches the field to a real + // value but the property already exists, so no shape transition fires. + this.enter( + {type: 'footnoteReference', identifier: '', label: '', position: undefined}, + token + ) } /** @@ -47,8 +53,16 @@ function enterFootnoteDefinitionLabelString() { * @type {FromMarkdownHandle} */ function enterFootnoteDefinition(token) { + // See enterFootnoteCall above for the rationale on the trailing + // position field. this.enter( - {type: 'footnoteDefinition', identifier: '', label: '', children: []}, + { + type: 'footnoteDefinition', + identifier: '', + label: '', + children: [], + position: undefined + }, token ) }