Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

/**
Expand All @@ -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
)
}
Expand Down
Loading