diff --git a/dev/lib/syntax.js b/dev/lib/syntax.js index ba0b534..1215c05 100644 --- a/dev/lib/syntax.js +++ b/dev/lib/syntax.js @@ -36,14 +36,19 @@ export function gfmFootnote() { return { document: { [codes.leftSquareBracket]: { + name: 'footnoteDefinition', tokenize: tokenizeDefinitionStart, continuation: {tokenize: tokenizeDefinitionContinuation}, exit: gfmFootnoteDefinitionEnd } }, text: { - [codes.leftSquareBracket]: {tokenize: tokenizeGfmFootnoteCall}, + [codes.leftSquareBracket]: { + name: 'footnoteCall', + tokenize: tokenizeGfmFootnoteCall + }, [codes.rightSquareBracket]: { + name: 'potentialFootnoteCall', add: 'after', tokenize: tokenizePotentialGfmFootnoteCall, resolveTo: resolveToPotentialGfmFootnoteCall diff --git a/test/index.js b/test/index.js index e8bd2d4..360eacc 100644 --- a/test/index.js +++ b/test/index.js @@ -46,6 +46,30 @@ test('micromark-extension-gfm-footnote', async function (t) { ) }) + await t.test( + 'should skip calls and definitions construct if `disable.null` includes `footnoteDefinition` and `footnoteCall`', + async function () { + assert.deepEqual( + micromark('A call.[^a]\n\n[^a]: whatevs', { + extensions: [ + gfmFootnote(), + { + disable: { + null: [ + 'footnoteDefinition', + 'footnoteCall', + 'potentialFootnoteCall' + ] + } + } + ], + htmlExtensions: [gfmFootnoteHtml()] + }), + '

A call.^a

\n' + ) + } + ) + await t.test( 'should support `options.label`, `options.backLabel`', async function () {