Skip to content

Commit

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

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
  • Loading branch information
shlroland authored Jul 8, 2024
1 parent a271caa commit fa6124c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dev/lib/math-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {codes, constants, types} from 'micromark-util-symbol'
/** @type {Construct} */
export const mathFlow = {
tokenize: tokenizeMathFenced,
concrete: true
concrete: true,
name: 'mathFlow'
}

/** @type {Construct} */
Expand Down
3 changes: 2 additions & 1 deletion dev/lib/math-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export function mathText(options) {
return {
tokenize: tokenizeMathText,
resolve: resolveMathText,
previous
previous,
name: 'mathText'
}

/**
Expand Down
13 changes: 13 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ test('math', async function (t) {
)
})

await t.test(
'should skip `mathFlow` and `mathText` construct if `disable.null` includes `mathFlow` and `mathText`',
async function () {
assert.equal(
micromark('$a$, $$b$$, $$$c$$$', {
extensions: [math(), {disable: {null: ['mathFlow', 'mathText']}}],
htmlExtensions: [mathHtml()]
}),
'<p>$a$, $$b$$, $$$c$$$</p>'
)
}
)

await t.test(
'should support one, two, or more dollars by default',
async function () {
Expand Down

0 comments on commit fa6124c

Please sign in to comment.