Skip to content

Commit

Permalink
Add name
Browse files Browse the repository at this point in the history
Closes GH-5.

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
shlroland committed Jul 5, 2024
1 parent 01620d2 commit b0c8361
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dev/lib/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
}),
'<p>A call.<a href="whatevs">^a</a></p>\n'
)
}
)

await t.test(
'should support `options.label`, `options.backLabel`',
async function () {
Expand Down

0 comments on commit b0c8361

Please sign in to comment.