From e55aa2a8b7a36c76d175dec01293c095f7717b7b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 29 Jun 2023 11:50:05 +0200 Subject: [PATCH] Refactor code-style --- dev/index.d.ts | 2 - dev/lib/factory-attributes.js | 3 +- dev/lib/factory-label.js | 5 +- dev/lib/html.js | 11 +- package.json | 14 +- test/index.js | 2679 +++++++++++++++++---------------- 6 files changed, 1441 insertions(+), 1273 deletions(-) diff --git a/dev/index.d.ts b/dev/index.d.ts index 3f979f0..c067855 100644 --- a/dev/index.d.ts +++ b/dev/index.d.ts @@ -9,7 +9,6 @@ export { } from './lib/html.js' declare module 'micromark-util-types' { - // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface TokenTypeMap { directiveContainer: 'directiveContainer' directiveContainerAttributes: 'directiveContainerAttributes' @@ -74,7 +73,6 @@ declare module 'micromark-util-types' { directiveTextName: 'directiveTextName' } - // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface CompileData { directiveAttributes?: Attribute[] directiveStack?: Directive[] diff --git a/dev/lib/factory-attributes.js b/dev/lib/factory-attributes.js index d39cf76..60be654 100644 --- a/dev/lib/factory-attributes.js +++ b/dev/lib/factory-attributes.js @@ -33,9 +33,8 @@ import {types} from 'micromark-util-symbol/types.js' * @param {TokenType} attributeValueType * @param {TokenType} attributeValueMarker * @param {TokenType} attributeValueData - * @param {boolean} [disallowEol=false] + * @param {boolean | undefined} [disallowEol=false] */ -/* eslint-disable-next-line max-params */ export function factoryAttributes( effects, ok, diff --git a/dev/lib/factory-label.js b/dev/lib/factory-label.js index 76030dc..60d07f8 100644 --- a/dev/lib/factory-label.js +++ b/dev/lib/factory-label.js @@ -23,9 +23,8 @@ import {types} from 'micromark-util-symbol/types.js' * @param {TokenType} type * @param {TokenType} markerType * @param {TokenType} stringType - * @param {boolean} [disallowEol=false] + * @param {boolean | undefined} [disallowEol=false] */ -// eslint-disable-next-line max-params export function factoryLabel( effects, ok, @@ -37,7 +36,7 @@ export function factoryLabel( ) { let size = 0 let balance = 0 - /** @type {Token|undefined} */ + /** @type {Token | undefined} */ let previous return start diff --git a/dev/lib/html.js b/dev/lib/html.js index 7086528..a02bfee 100644 --- a/dev/lib/html.js +++ b/dev/lib/html.js @@ -22,8 +22,9 @@ * Current context. * @param {Directive} directive * Directive. - * @returns {boolean | void} + * @returns {boolean | undefined} * Signal whether the directive was handled. + * * Yield `false` to let the fallback (a special handle for `'*'`) handle it. * * @typedef Directive @@ -54,8 +55,8 @@ const own = {}.hasOwnProperty * Create an extension for `micromark` to support directives when serializing * to HTML. * - * @param {HtmlOptions | null | undefined} [options] - * Configuration. + * @param {HtmlOptions | null | undefined} [options={}] + * Configuration (default: `{}`). * @returns {HtmlExtension} * Extension for `micromark` that can be passed in `htmlExtensions`, to * support directives when serializing to HTML. @@ -283,9 +284,9 @@ export function directiveHtml(options) { assert(stack, 'expected directive stack') const directive = stack.pop() assert(directive, 'expected directive') - /** @type {boolean|undefined} */ + /** @type {boolean | undefined} */ let found - /** @type {boolean|void} */ + /** @type {boolean | undefined} */ let result assert(directive.name, 'expected `name`') diff --git a/package.json b/package.json index 26784fd..586a4fe 100644 --- a/package.json +++ b/package.json @@ -90,11 +90,21 @@ "strict": true }, "xo": { + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/consistent-type-definitions": "off" + } + } + ], "prettier": true, "rules": { + "max-params": "off", "n/file-extension-in-import": "off", - "unicorn/no-this-assignment": "off", - "unicorn/prefer-node-protocol": "off" + "unicorn/no-this-assignment": "off" } } } diff --git a/test/index.js b/test/index.js index 8944261..e72121a 100644 --- a/test/index.js +++ b/test/index.js @@ -8,1478 +8,1638 @@ import assert from 'node:assert/strict' import test from 'node:test' import {micromark} from 'micromark' import {htmlVoidElements} from 'html-void-elements' -import { - directive as syntax, - directiveHtml as html -} from 'micromark-extension-directive' +import {directive, directiveHtml} from 'micromark-extension-directive' const own = {}.hasOwnProperty -test('core', async () => { - assert.deepEqual( - Object.keys(await import('micromark-extension-directive')).sort(), - ['directive', 'directiveHtml'], - 'should expose the public api' +test('micromark-extension-directive (syntax, text)', async function (t) { + await t.test('should expose the public api', async function () { + assert.deepEqual( + Object.keys(await import('micromark-extension-directive')).sort(), + ['directive', 'directiveHtml'] + ) + }) + + await t.test( + 'should support an escaped colon which would otherwise be a directive', + async function () { + assert.equal(micromark('\\:a', options()), '

:a

') + } + ) + + await t.test( + 'should support a directive after an escaped colon', + async function () { + assert.equal(micromark('\\::a', options()), '

:

') + } + ) + + await t.test( + 'should not support a directive after a colon', + async function () { + assert.equal(micromark('a ::b', options()), '

a ::b

') + } + ) + + await t.test( + 'should not support a colon not followed by an alpha', + async function () { + assert.equal(micromark(':', options()), '

:

') + } + ) + + await t.test( + 'should support a colon followed by an alpha', + async function () { + assert.equal(micromark(':a', options()), '

') + } + ) + + await t.test( + 'should not support a colon followed by a digit', + async function () { + assert.equal(micromark(':9', options()), '

:9

') + } + ) + + await t.test( + 'should not support a colon followed by a dash', + async function () { + assert.equal(micromark(':-', options()), '

:-

') + } + ) + + await t.test( + 'should not support a colon followed by an underscore', + async function () { + assert.equal(micromark(':_', options()), '

:_

') + } + ) + + await t.test('should support a digit in a name', async function () { + assert.equal(micromark(':a9', options()), '

') + }) + + await t.test('should support a dash in a name', async function () { + assert.equal(micromark(':a-b', options()), '

') + }) + + await t.test( + 'should *not* support a dash at the end of a name', + async function () { + assert.equal(micromark(':a-', options()), '

:a-

') + } + ) + + await t.test('should support an underscore in a name', async function () { + assert.equal(micromark(':a_b', options()), '

') + }) + + await t.test( + 'should *not* support an underscore at the end of a name', + async function () { + assert.equal(micromark(':a_', options()), '

:a_

') + } + ) + + await t.test( + 'should *not* support a colon right after a name', + async function () { + assert.equal(micromark(':a:', options()), '

:a:

') + } + ) + + await t.test('should not interfere w/ gemoji (1)', async function () { + assert.equal(micromark(':+1:', options()), '

:+1:

') + }) + + await t.test('should not interfere w/ gemoji (2)', async function () { + assert.equal(micromark(':heart:', options()), '

:heart:

') + }) + + await t.test('should not interfere w/ gemoji (3)', async function () { + assert.equal( + micromark(':call_me_hand:', options()), + '

:call_me_hand:

' + ) + }) + + await t.test('should not interfere w/ emphasis (`_`)', async function () { + assert.equal( + micromark('_:directive_', options()), + '

:directive

' + ) + }) + + await t.test( + 'should support a name followed by an unclosed `[`', + async function () { + assert.equal(micromark(':a[', options()), '

[

') + } + ) + + await t.test( + 'should support a name followed by an unclosed `{`', + async function () { + assert.equal(micromark(':a{', options()), '

{

') + } + ) + + await t.test( + 'should support a name followed by an unclosed `[` w/ content', + async function () { + assert.equal(micromark(':a[b', options()), '

[b

') + } + ) + + await t.test( + 'should support a name followed by an unclosed `{` w/ content', + async function () { + assert.equal(micromark(':a{b', options()), '

{b

') + } + ) + + await t.test('should support an empty label', async function () { + assert.equal(micromark(':a[]', options()), '

') + }) + + await t.test('should support a whitespace only label', async function () { + assert.equal(micromark(':a[ \t]', options()), '

') + }) + + await t.test('should support an eol in an label', async function () { + assert.equal(micromark(':a[\n]', options()), '

') + }) + + await t.test('should support content in an label', async function () { + assert.equal(micromark(':a[a b c]asd', options()), '

asd

') + }) + + await t.test('should support markdown in an label', async function () { + assert.equal(micromark(':a[a *b* c]asd', options()), '

asd

') + }) + + await t.test('should support a directive in an label', async function () { + assert.equal(micromark('a :b[c :d[e] f] g', options()), '

a g

') + }) + + await t.test('should support content after a label', async function () { + assert.equal(micromark(':a[]asd', options()), '

asd

') + }) + + await t.test('should support empty attributes', async function () { + assert.equal(micromark(':a{}', options()), '

') + }) + + await t.test('should support whitespace only attributes', async function () { + assert.equal(micromark(':a{ \t}', options()), '

') + }) + + await t.test('should support an eol in attributes', async function () { + assert.equal(micromark(':a{\n}', options()), '

') + }) + + await t.test('should support attributes w/o values', async function () { + assert.equal(micromark(':a{a b c}', options()), '

') + }) + + await t.test( + 'should support attributes w/ unquoted values', + async function () { + assert.equal(micromark(':a{a=b c=d}', options()), '

') + } + ) + + await t.test( + 'should support attributes w/ class shortcut', + async function () { + assert.equal(micromark(':a{.a .b}', options()), '

') + } + ) + + await t.test( + 'should support attributes w/ class shortcut w/o whitespace between', + async function () { + assert.equal(micromark(':a{.a.b}', options()), '

') + } + ) + + await t.test('should support attributes w/ id shortcut', async function () { + assert.equal(micromark(':a{#a #b}', options()), '

') + }) + + await t.test( + 'should support attributes w/ id shortcut w/o whitespace between', + async function () { + assert.equal(micromark(':a{#a#b}', options()), '

') + } + ) + + await t.test( + 'should support attributes w/ shortcuts combined w/ other attributes', + async function () { + assert.equal(micromark(':a{#a.b.c#d e f=g #h.i.j}', options()), '

') + } + ) + + await t.test('should not support an empty shortcut (`.`)', async function () { + assert.equal(micromark(':a{..b}', options()), '

{..b}

') + }) + + await t.test('should not support an empty shortcut (`#`)', async function () { + assert.equal(micromark(':a{.#b}', options()), '

{.#b}

') + }) + + await t.test('should not support an empty shortcut (`}`)', async function () { + assert.equal(micromark(':a{.}', options()), '

{.}

') + }) + + await t.test( + 'should not support certain characters in shortcuts (`=`)', + async function () { + assert.equal(micromark(':a{.a=b}', options()), '

{.a=b}

') + } + ) + + await t.test( + 'should not support certain characters in shortcuts (`"`)', + async function () { + assert.equal(micromark(':a{.a"b}', options()), '

{.a"b}

') + } + ) + + await t.test( + 'should not support certain characters in shortcuts (`<`)', + async function () { + assert.equal(micromark(':a{.a{.a<b}

') + } + ) + + await t.test( + 'should support most characters in shortcuts', + async function () { + assert.equal(micromark(':a{.ađź’šb}', options()), '

') + } + ) + + await t.test( + 'should support an underscore in attribute names', + async function () { + assert.equal(micromark(':a{_}', options()), '

') + } + ) + + await t.test('should support a colon in attribute names', async function () { + assert.equal(micromark(':a{xml:lang}', options()), '

') + }) + + await t.test('should support double quoted attributes', async function () { + assert.equal(micromark(':a{a="b" c="d e f"}', options()), '

') + }) + + await t.test('should support single quoted attributes', async function () { + assert.equal(micromark(":a{a='b' c='d e f'}", options()), '

') + }) + + await t.test( + 'should support whitespace around initializers', + async function () { + assert.equal( + micromark(':a{a = b c\t=\t\'d\' f =\r"g"}', options()), + '

' + ) + } + ) + + await t.test( + 'should not support `=` to start an unquoted attribute value', + async function () { + assert.equal(micromark(':a{b==}', options()), '

{b==}

') + } + ) + + await t.test( + 'should not support a missing attribute value after `=`', + async function () { + assert.equal(micromark(':a{b=}', options()), '

{b=}

') + } + ) + + await t.test( + 'should not support an apostrophe in an unquoted attribute value', + async function () { + assert.equal(micromark(":a{b=c'}", options()), "

{b=c'}

") + } + ) + + await t.test( + 'should not support a grave accent in an unquoted attribute value', + async function () { + assert.equal(micromark(':a{b=c`}', options()), '

{b=c`}

') + } + ) + + await t.test( + 'should support most other characters in unquoted attribute values', + async function () { + assert.equal(micromark(':a{b=ađź’šb}', options()), '

') + } + ) + + await t.test( + 'should not support an EOF in a quoted attribute value', + async function () { + assert.equal(micromark(':a{b="c', options()), '

{b="c

') + } + ) + + await t.test( + 'should support most other characters in quoted attribute values', + async function () { + assert.equal(micromark(':a{b="ađź’šb"}', options()), '

') + } + ) + + await t.test( + 'should support EOLs in quoted attribute values', + async function () { + assert.equal(micromark(':a{b="\nc\r d"}', options()), '

') + } + ) + + await t.test( + 'should not support an EOF after a quoted attribute value', + async function () { + assert.equal(micromark(':a{b="c"', options()), '

{b="c"

') + } ) }) -test('micromark-extension-directive (syntax, text)', () => { - assert.equal( - micromark('\\:a', options()), - '

:a

', - 'should support an escaped colon which would otherwise be a directive' +test('micromark-extension-directive (syntax, leaf)', async function (t) { + await t.test('should support a directive', async function () { + assert.equal(micromark('::b', options()), '') + }) + + await t.test('should not support one colon', async function () { + assert.equal(micromark(':', options()), '

:

') + }) + + await t.test( + 'should not support two colons not followed by an alpha', + async function () { + assert.equal(micromark('::', options()), '

::

') + } ) - assert.equal( - micromark('\\::a', options()), - '

:

', - 'should support a directive after an escaped colon' + await t.test( + 'should support two colons followed by an alpha', + async function () { + assert.equal(micromark('::a', options()), '') + } ) - assert.equal( - micromark('a ::b', options()), - '

a ::b

', - 'should not support a directive after a colon' + await t.test( + 'should not support two colons followed by a digit', + async function () { + assert.equal(micromark('::9', options()), '

::9

') + } ) - assert.equal( - micromark(':', options()), - '

:

', - 'should not support a colon not followed by an alpha' + await t.test( + 'should not support two colons followed by a dash', + async function () { + assert.equal(micromark('::-', options()), '

::-

') + } ) - assert.equal( - micromark(':a', options()), - '

', - 'should support a colon followed by an alpha' + await t.test('should support a digit in a name', async function () { + assert.equal(micromark('::a9', options()), '') + }) + + await t.test('should support a dash in a name', async function () { + assert.equal(micromark('::a-b', options()), '') + }) + + await t.test( + 'should not support a name followed by an unclosed `[`', + async function () { + assert.equal(micromark('::a[', options()), '

::a[

') + } ) - assert.equal( - micromark(':9', options()), - '

:9

', - 'should not support a colon followed by a digit' + await t.test( + 'should not support a name followed by an unclosed `{`', + async function () { + assert.equal(micromark('::a{', options()), '

::a{

') + } ) - assert.equal( - micromark(':-', options()), - '

:-

', - 'should not support a colon followed by a dash' + await t.test( + 'should not support a name followed by an unclosed `[` w/ content', + async function () { + assert.equal(micromark('::a[b', options()), '

::a[b

') + } ) - assert.equal( - micromark(':_', options()), - '

:_

', - 'should not support a colon followed by an underscore' + await t.test( + 'should not support a name followed by an unclosed `{` w/ content', + async function () { + assert.equal(micromark('::a{b', options()), '

::a{b

') + } ) - assert.equal( - micromark(':a9', options()), - '

', - 'should support a digit in a name' + await t.test('should support an empty label', async function () { + assert.equal(micromark('::a[]', options()), '') + }) + + await t.test('should support a whitespace only label', async function () { + assert.equal(micromark('::a[ \t]', options()), '') + }) + + await t.test('should not support an eol in an label', async function () { + assert.equal(micromark('::a[\n]', options()), '

::a[\n]

') + }) + + await t.test('should support content in an label', async function () { + assert.equal(micromark('::a[a b c]', options()), '') + }) + + await t.test('should support markdown in an label', async function () { + assert.equal(micromark('::a[a *b* c]', options()), '') + }) + + await t.test('should not support content after a label', async function () { + assert.equal(micromark('::a[]asd', options()), '

::a[]asd

') + }) + + await t.test('should support empty attributes', async function () { + assert.equal(micromark('::a{}', options()), '') + }) + + await t.test('should support whitespace only attributes', async function () { + assert.equal(micromark('::a{ \t}', options()), '') + }) + + await t.test('should not support an eol in attributes', async function () { + assert.equal(micromark('::a{\n}', options()), '

::a{\n}

') + }) + + await t.test('should support attributes w/o values', async function () { + assert.equal(micromark('::a{a b c}', options()), '') + }) + + await t.test( + 'should support attributes w/ unquoted values', + async function () { + assert.equal(micromark('::a{a=b c=d}', options()), '') + } ) - assert.equal( - micromark(':a-b', options()), - '

', - 'should support a dash in a name' + await t.test( + 'should support attributes w/ class shortcut', + async function () { + assert.equal(micromark('::a{.a .b}', options()), '') + } ) - assert.equal( - micromark(':a-', options()), - '

:a-

', - 'should *not* support a dash at the end of a name' + await t.test('should support attributes w/ id shortcut', async function () { + assert.equal(micromark('::a{#a #b}', options()), '') + }) + + await t.test( + 'should support most characters in shortcuts', + async function () { + assert.equal(micromark('::a{.ađź’šb}', options()), '') + } ) - assert.equal( - micromark(':a_b', options()), - '

', - 'should support an underscore in a name' + await t.test('should support double quoted attributes', async function () { + assert.equal(micromark('::a{a="b" c="d e f"}', options()), '') + }) + + await t.test('should support single quoted attributes', async function () { + assert.equal(micromark("::a{a='b' c='d e f'}", options()), '') + }) + + await t.test( + 'should support whitespace around initializers', + async function () { + assert.equal(micromark("::a{a = b c\t=\t'd'}", options()), '') + } ) - assert.equal( - micromark(':a_', options()), - '

:a_

', - 'should *not* support an underscore at the end of a name' + await t.test( + 'should not support EOLs around initializers', + async function () { + assert.equal(micromark('::a{f =\rg}', options()), '

::a{f =\rg}

') + } ) - assert.equal( - micromark(':a:', options()), - '

:a:

', - 'should *not* support a colon right after a name' + await t.test( + 'should not support `=` to start an unquoted attribute value', + async function () { + assert.equal(micromark('::a{b==}', options()), '

::a{b==}

') + } ) - assert.equal( - micromark(':+1:', options()), - '

:+1:

', - 'should not interfere w/ gemoji (1)' + await t.test( + 'should support most other characters in unquoted attribute values', + async function () { + assert.equal(micromark('::a{b=ađź’šb}', options()), '') + } ) - assert.equal( - micromark(':heart:', options()), - '

:heart:

', - 'should not interfere w/ gemoji (2)' + await t.test( + 'should not support an EOF in a quoted attribute value', + async function () { + assert.equal(micromark('::a{b="c', options()), '

::a{b="c

') + } ) - assert.equal( - micromark(':call_me_hand:', options()), - '

:call_me_hand:

', - 'should not interfere w/ gemoji (3)' + await t.test( + 'should support most other characters in quoted attribute values', + async function () { + assert.equal(micromark('::a{b="ađź’šb"}', options()), '') + } ) - assert.equal( - micromark('_:directive_', options()), - '

:directive

', - 'should not interfere w/ emphasis (`_`)' + await t.test( + 'should not support EOLs in quoted attribute values', + async function () { + assert.equal( + micromark('::a{b="\nc\r d"}', options()), + '

::a{b="\nc\rd"}

' + ) + } ) - assert.equal( - micromark(':a[', options()), - '

[

', - 'should support a name followed by an unclosed `[`' + await t.test( + 'should not support an EOF after a quoted attribute value', + async function () { + assert.equal( + micromark('::a{b="c"', options()), + '

::a{b="c"

' + ) + } ) - assert.equal( - micromark(':a{', options()), - '

{

', - 'should support a name followed by an unclosed `{`' + await t.test('should support whitespace after directives', async function () { + assert.equal(micromark('::a{b=c} \t ', options()), '') + }) + + await t.test('should support a block quote after a leaf', async function () { + assert.equal( + micromark('::a{b=c}\n>a', options()), + '
\n

a

\n
' + ) + }) + + await t.test('should support code (fenced) after a leaf', async function () { + assert.equal( + micromark('::a{b=c}\n```js\na', options()), + '
a\n
\n' + ) + }) + + await t.test( + 'should support code (indented) after a leaf', + async function () { + assert.equal( + micromark('::a{b=c}\n a', options()), + '
a\n
' + ) + } ) - assert.equal( - micromark(':a[b', options()), - '

[b

', - 'should support a name followed by an unclosed `[` w/ content' + await t.test('should support a definition after a leaf', async function () { + assert.equal(micromark('::a{b=c}\n[a]: b', options()), '') + }) + + await t.test( + 'should support a heading (atx) after a leaf', + async function () { + assert.equal(micromark('::a{b=c}\n# a', options()), '

a

') + } ) - assert.equal( - micromark(':a{b', options()), - '

{b

', - 'should support a name followed by an unclosed `{` w/ content' + await t.test( + 'should support a heading (setext) after a leaf', + async function () { + assert.equal(micromark('::a{b=c}\na\n=', options()), '

a

') + } ) - assert.equal( - micromark(':a[]', options()), - '

', - 'should support an empty label' + await t.test('should support html after a leaf', async function () { + assert.equal(micromark('::a{b=c}\n', options()), '') + }) + + await t.test('should support a list after a leaf', async function () { + assert.equal( + micromark('::a{b=c}\n* a', options()), + '' + ) + }) + + await t.test('should support a paragraph after a leaf', async function () { + assert.equal(micromark('::a{b=c}\na', options()), '

a

') + }) + + await t.test( + 'should support a thematic break after a leaf', + async function () { + assert.equal(micromark('::a{b=c}\n***', options()), '
') + } ) - assert.equal( - micromark(':a[ \t]', options()), - '

', - 'should support a whitespace only label' + await t.test('should support a block quote before a leaf', async function () { + assert.equal( + micromark('>a\n::a{b=c}', options()), + '
\n

a

\n
\n' + ) + }) + + await t.test('should support code (fenced) before a leaf', async function () { + assert.equal( + micromark('```js\na\n```\n::a{b=c}', options()), + '
a\n
\n' + ) + }) + + await t.test( + 'should support code (indented) before a leaf', + async function () { + assert.equal( + micromark(' a\n::a{b=c}', options()), + '
a\n
\n' + ) + } ) - assert.equal( - micromark(':a[\n]', options()), - '

', - 'should support an eol in an label' + await t.test('should support a definition before a leaf', async function () { + assert.equal(micromark('[a]: b\n::a{b=c}', options()), '') + }) + + await t.test( + 'should support a heading (atx) before a leaf', + async function () { + assert.equal(micromark('# a\n::a{b=c}', options()), '

a

\n') + } ) - assert.equal( - micromark(':a[a b c]asd', options()), - '

asd

', - 'should support content in an label' + await t.test( + 'should support a heading (setext) before a leaf', + async function () { + assert.equal(micromark('a\n=\n::a{b=c}', options()), '

a

\n') + } ) - assert.equal( - micromark(':a[a *b* c]asd', options()), - '

asd

', - 'should support markdown in an label' + await t.test('should support html before a leaf', async function () { + assert.equal(micromark('\n::a{b=c}', options()), '\n') + }) + + await t.test('should support a list before a leaf', async function () { + assert.equal( + micromark('* a\n::a{b=c}', options()), + '\n' + ) + }) + + await t.test('should support a paragraph before a leaf', async function () { + assert.equal(micromark('a\n::a{b=c}', options()), '

a

\n') + }) + + await t.test( + 'should support a thematic break before a leaf', + async function () { + assert.equal(micromark('***\n::a{b=c}', options()), '
\n') + } ) - assert.equal( - micromark('a :b[c :d[e] f] g', options()), - '

a g

', - 'should support a directive in an label' - ) + await t.test('should not support lazyness (1)', async function () { + assert.equal( + micromark('> ::a\nb', options({'*': h})), + '
\n
\n

b

' + ) + }) - assert.equal( - micromark(':a[]asd', options()), - '

asd

', - 'should support content after a label' - ) - - assert.equal( - micromark(':a{}', options()), - '

', - 'should support empty attributes' - ) - - assert.equal( - micromark(':a{ \t}', options()), - '

', - 'should support whitespace only attributes' - ) - - assert.equal( - micromark(':a{\n}', options()), - '

', - 'should support an eol in attributes' - ) - - assert.equal( - micromark(':a{a b c}', options()), - '

', - 'should support attributes w/o values' - ) - - assert.equal( - micromark(':a{a=b c=d}', options()), - '

', - 'should support attributes w/ unquoted values' - ) - - assert.equal( - micromark(':a{.a .b}', options()), - '

', - 'should support attributes w/ class shortcut' - ) - - assert.equal( - micromark(':a{.a.b}', options()), - '

', - 'should support attributes w/ class shortcut w/o whitespace between' - ) - - assert.equal( - micromark(':a{#a #b}', options()), - '

', - 'should support attributes w/ id shortcut' - ) - - assert.equal( - micromark(':a{#a#b}', options()), - '

', - 'should support attributes w/ id shortcut w/o whitespace between' - ) - - assert.equal( - micromark(':a{#a.b.c#d e f=g #h.i.j}', options()), - '

', - 'should support attributes w/ shortcuts combined w/ other attributes' - ) - - assert.equal( - micromark(':a{..b}', options()), - '

{..b}

', - 'should not support an empty shortcut (`.`)' - ) - - assert.equal( - micromark(':a{.#b}', options()), - '

{.#b}

', - 'should not support an empty shortcut (`#`)' - ) - - assert.equal( - micromark(':a{.}', options()), - '

{.}

', - 'should not support an empty shortcut (`}`)' - ) - - assert.equal( - micromark(':a{.a=b}', options()), - '

{.a=b}

', - 'should not support certain characters in shortcuts (`=`)' - ) - - assert.equal( - micromark(':a{.a"b}', options()), - '

{.a"b}

', - 'should not support certain characters in shortcuts (`"`)' - ) - - assert.equal( - micromark(':a{.a{.a<b}

', - 'should not support certain characters in shortcuts (`<`)' - ) - - assert.equal( - micromark(':a{.ađź’šb}', options()), - '

', - 'should support most characters in shortcuts' - ) - - assert.equal( - micromark(':a{_}', options()), - '

', - 'should support an underscore in attribute names' - ) - - assert.equal( - micromark(':a{xml:lang}', options()), - '

', - 'should support a colon in attribute names' - ) - - assert.equal( - micromark(':a{a="b" c="d e f"}', options()), - '

', - 'should support double quoted attributes' - ) - - assert.equal( - micromark(":a{a='b' c='d e f'}", options()), - '

', - 'should support single quoted attributes' - ) - - assert.equal( - micromark(':a{a = b c\t=\t\'d\' f =\r"g"}', options()), - '

', - 'should support whitespace around initializers' - ) - - assert.equal( - micromark(':a{b==}', options()), - '

{b==}

', - 'should not support `=` to start an unquoted attribute value' - ) - - assert.equal( - micromark(':a{b=}', options()), - '

{b=}

', - 'should not support a missing attribute value after `=`' - ) - - assert.equal( - micromark(":a{b=c'}", options()), - "

{b=c'}

", - 'should not support an apostrophe in an unquoted attribute value' - ) - - assert.equal( - micromark(':a{b=c`}', options()), - '

{b=c`}

', - 'should not support a grave accent in an unquoted attribute value' - ) - - assert.equal( - micromark(':a{b=ađź’šb}', options()), - '

', - 'should support most other characters in unquoted attribute values' - ) - - assert.equal( - micromark(':a{b="c', options()), - '

{b="c

', - 'should not support an EOF in a quoted attribute value' - ) - - assert.equal( - micromark(':a{b="ađź’šb"}', options()), - '

', - 'should support most other characters in quoted attribute values' - ) - - assert.equal( - micromark(':a{b="\nc\r d"}', options()), - '

', - 'should support EOLs in quoted attribute values' - ) - - assert.equal( - micromark(':a{b="c"', options()), - '

{b="c"

', - 'should not support an EOF after a quoted attribute value' - ) + await t.test('should not support lazyness (2)', async function () { + assert.equal( + micromark('> a\n::b', options({'*': h})), + '
\n

a

\n
\n' + ) + }) }) -test('micromark-extension-directive (syntax, leaf)', () => { - assert.equal(micromark('::b', options()), '', 'should support a directive') +test('micromark-extension-directive (syntax, container)', async function (t) { + await t.test('should support a directive', async function () { + assert.equal(micromark(':::b', options()), '') + }) - assert.equal( - micromark(':', options()), - '

:

', - 'should not support one colon' + await t.test('should not support one colon', async function () { + assert.equal(micromark(':', options()), '

:

') + }) + + await t.test( + 'should not support two colons not followed by an alpha', + async function () { + assert.equal(micromark('::', options()), '

::

') + } ) - assert.equal( - micromark('::', options()), - '

::

', - 'should not support two colons not followed by an alpha' + await t.test( + 'should not support three colons not followed by an alpha', + async function () { + assert.equal(micromark(':::', options()), '

:::

') + } ) - assert.equal( - micromark('::a', options()), - '', - 'should support two colons followed by an alpha' + await t.test( + 'should support three colons followed by an alpha', + async function () { + assert.equal(micromark(':::a', options()), '') + } ) - assert.equal( - micromark('::9', options()), - '

::9

', - 'should not support two colons followed by a digit' + await t.test( + 'should not support three colons followed by a digit', + async function () { + assert.equal(micromark(':::9', options()), '

:::9

') + } ) - assert.equal( - micromark('::-', options()), - '

::-

', - 'should not support two colons followed by a dash' + await t.test( + 'should not support three colons followed by a dash', + async function () { + assert.equal(micromark(':::-', options()), '

:::-

') + } ) - assert.equal( - micromark('::a9', options()), - '', - 'should support a digit in a name' + await t.test('should support a digit in a name', async function () { + assert.equal(micromark(':::a9', options()), '') + }) + + await t.test('should support a dash in a name', async function () { + assert.equal(micromark(':::a-b', options()), '') + }) + + await t.test( + 'should not support a name followed by an unclosed `[`', + async function () { + assert.equal(micromark(':::a[', options()), '

:::a[

') + } ) - assert.equal( - micromark('::a-b', options()), - '', - 'should support a dash in a name' + await t.test( + 'should not support a name followed by an unclosed `{`', + async function () { + assert.equal(micromark(':::a{', options()), '

:::a{

') + } ) - assert.equal( - micromark('::a[', options()), - '

::a[

', - 'should not support a name followed by an unclosed `[`' + await t.test( + 'should not support a name followed by an unclosed `[` w/ content', + async function () { + assert.equal(micromark(':::a[b', options()), '

:::a[b

') + } ) - assert.equal( - micromark('::a{', options()), - '

::a{

', - 'should not support a name followed by an unclosed `{`' + await t.test( + 'should not support a name followed by an unclosed `{` w/ content', + async function () { + assert.equal(micromark(':::a{b', options()), '

:::a{b

') + } ) - assert.equal( - micromark('::a[b', options()), - '

::a[b

', - 'should not support a name followed by an unclosed `[` w/ content' + await t.test('should support an empty label', async function () { + assert.equal(micromark(':::a[]', options()), '') + }) + + await t.test('should support a whitespace only label', async function () { + assert.equal(micromark(':::a[ \t]', options()), '') + }) + + await t.test('should not support an eol in an label', async function () { + assert.equal(micromark(':::a[\n]', options()), '

:::a[\n]

') + }) + + await t.test('should support content in an label', async function () { + assert.equal(micromark(':::a[a b c]', options()), '') + }) + + await t.test('should support markdown in an label', async function () { + assert.equal(micromark(':::a[a *b* c]', options()), '') + }) + + await t.test('should not support content after a label', async function () { + assert.equal(micromark(':::a[]asd', options()), '

:::a[]asd

') + }) + + await t.test('should support empty attributes', async function () { + assert.equal(micromark(':::a{}', options()), '') + }) + + await t.test('should support whitespace only attributes', async function () { + assert.equal(micromark(':::a{ \t}', options()), '') + }) + + await t.test('should not support an eol in attributes', async function () { + assert.equal(micromark(':::a{\n}', options()), '

:::a{\n}

') + }) + + await t.test('should support attributes', async function () { + assert.equal(micromark(':::a{a b c}', options()), '') + }) + + await t.test( + 'should not support EOLs around initializers', + async function () { + assert.equal( + micromark(':::a{f =\rg}', options()), + '

:::a{f =\rg}

' + ) + } ) - assert.equal( - micromark('::a{b', options()), - '

::a{b

', - 'should not support a name followed by an unclosed `{` w/ content' + await t.test( + 'should not support an EOF in a quoted attribute value', + async function () { + assert.equal(micromark(':::a{b="c', options()), '

:::a{b="c

') + } ) - assert.equal( - micromark('::a[]', options()), - '', - 'should support an empty label' + await t.test( + 'should not support EOLs in quoted attribute values', + async function () { + assert.equal( + micromark(':::a{b="\nc\r d"}', options()), + '

:::a{b="\nc\rd"}

' + ) + } ) - assert.equal( - micromark('::a[ \t]', options()), - '', - 'should support a whitespace only label' + await t.test( + 'should not support an EOF after a quoted attribute value', + async function () { + assert.equal( + micromark(':::a{b="c"', options()), + '

:::a{b="c"

' + ) + } ) - assert.equal( - micromark('::a[\n]', options()), - '

::a[\n]

', - 'should not support an eol in an label' + await t.test('should support whitespace after directives', async function () { + assert.equal(micromark(':::a{b=c} \t ', options()), '') + }) + + await t.test('should support no closing fence', async function () { + assert.equal(micromark(':::a\n', options()), '') + }) + + await t.test('should support an immediate closing fence', async function () { + assert.equal(micromark(':::a\n:::', options()), '') + }) + + await t.test( + 'should support content after a closing fence', + async function () { + assert.equal(micromark(':::a\n:::\nb', options()), '

b

') + } ) - assert.equal( - micromark('::a[a b c]', options()), - '', - 'should support content in an label' + await t.test( + 'should not close w/ a “closing” fence of two colons', + async function () { + assert.equal(micromark(':::a\n::\nb', options()), '') + } ) - assert.equal( - micromark('::a[a *b* c]', options()), - '', - 'should support markdown in an label' + await t.test( + 'should close w/ a closing fence of more colons', + async function () { + assert.equal(micromark(':::a\n::::\nb', options()), '

b

') + } ) - assert.equal( - micromark('::a[]asd', options()), - '

::a[]asd

', - 'should not support content after a label' + await t.test('should support more opening colons', async function () { + assert.equal(micromark('::::a\n::::\nb', options()), '

b

') + }) + + await t.test( + 'should not close w/ a “closing” fence of less colons than the opening', + async function () { + assert.equal(micromark(':::::a\n::::\nb', options()), '') + } ) - assert.equal( - micromark('::a{}', options()), - '', - 'should support empty attributes' + await t.test( + 'should close w/ a closing fence followed by white space', + async function () { + assert.equal(micromark(':::a\n::: \t\nc', options()), '

c

') + } ) - assert.equal( - micromark('::a{ \t}', options()), - '', - 'should support whitespace only attributes' + await t.test( + 'should not close w/ a “closing” fence followed by other characters', + async function () { + assert.equal(micromark(':::a\n::: b\nc', options()), '') + } ) - assert.equal( - micromark('::a{\n}', options()), - '

::a{\n}

', - 'should not support an eol in attributes' + await t.test('should close w/ an indented closing fence', async function () { + assert.equal(micromark(':::a\n :::\nc', options()), '

c

') + }) + + await t.test( + 'should not close w/ when the “closing” fence is indented at a tab size', + async function () { + assert.equal(micromark(':::a\n\t:::\nc', options()), '') + } ) - assert.equal( - micromark('::a{a b c}', options()), - '', - 'should support attributes w/o values' + await t.test( + 'should not close w/ when the “closing” fence is indented more than a tab size', + async function () { + assert.equal(micromark(':::a\n :::\nc', options()), '') + } ) - assert.equal( - micromark('::a{a=b c=d}', options()), - '', - 'should support attributes w/ unquoted values' + await t.test('should support blank lines in content', async function () { + assert.equal(micromark(':::a\n\n \n\ta', options()), '') + }) + + await t.test('should support an EOL EOF', async function () { + assert.equal(micromark(':::a\n\ta\n', options()), '') + }) + + await t.test('should support an indented directive', async function () { + assert.equal(micromark(' :::a\n b\n :::\nc', options()), '

c

') + }) + + await t.test( + 'should still not close an indented directive when the “closing” fence is indented a tab size', + async function () { + assert.equal(micromark(' :::a\n\t:::\nc', options()), '') + } ) - assert.equal( - micromark('::a{.a .b}', options()), - '', - 'should support attributes w/ class shortcut' + await t.test( + 'should support a block quote after a container', + async function () { + assert.equal( + micromark(':::a\n:::\n>a', options()), + '
\n

a

\n
' + ) + } ) - assert.equal( - micromark('::a{#a #b}', options()), - '', - 'should support attributes w/ id shortcut' + await t.test( + 'should support code (fenced) after a container', + async function () { + assert.equal( + micromark(':::a\n:::\n```js\na', options()), + '
a\n
\n' + ) + } ) - assert.equal( - micromark('::a{.ađź’šb}', options()), - '', - 'should support most characters in shortcuts' + await t.test( + 'should support code (indented) after a container', + async function () { + assert.equal( + micromark(':::a\n:::\n a', options()), + '
a\n
' + ) + } ) - assert.equal( - micromark('::a{a="b" c="d e f"}', options()), - '', - 'should support double quoted attributes' + await t.test( + 'should support a definition after a container', + async function () { + assert.equal(micromark(':::a\n:::\n[a]: b', options()), '') + } ) - assert.equal( - micromark("::a{a='b' c='d e f'}", options()), - '', - 'should support single quoted attributes' + await t.test( + 'should support a heading (atx) after a container', + async function () { + assert.equal(micromark(':::a\n:::\n# a', options()), '

a

') + } ) - assert.equal( - micromark("::a{a = b c\t=\t'd'}", options()), - '', - 'should support whitespace around initializers' + await t.test( + 'should support a heading (setext) after a container', + async function () { + assert.equal(micromark(':::a\n:::\na\n=', options()), '

a

') + } ) - assert.equal( - micromark('::a{f =\rg}', options()), - '

::a{f =\rg}

', - 'should not support EOLs around initializers' + await t.test('should support html after a container', async function () { + assert.equal(micromark(':::a\n:::\n', options()), '') + }) + + await t.test('should support a list after a container', async function () { + assert.equal( + micromark(':::a\n:::\n* a', options()), + '
    \n
  • a
  • \n
' + ) + }) + + await t.test( + 'should support a paragraph after a container', + async function () { + assert.equal(micromark(':::a\n:::\na', options()), '

a

') + } ) - assert.equal( - micromark('::a{b==}', options()), - '

::a{b==}

', - 'should not support `=` to start an unquoted attribute value' + await t.test( + 'should support a thematic break after a container', + async function () { + assert.equal(micromark(':::a\n:::\n***', options()), '
') + } ) - assert.equal( - micromark('::a{b=ađź’šb}', options()), - '', - 'should support most other characters in unquoted attribute values' + await t.test( + 'should support a block quote before a container', + async function () { + assert.equal( + micromark('>a\n:::a\nb', options()), + '
\n

a

\n
\n' + ) + } ) - assert.equal( - micromark('::a{b="c', options()), - '

::a{b="c

', - 'should not support an EOF in a quoted attribute value' + await t.test( + 'should support code (fenced) before a container', + async function () { + assert.equal( + micromark('```js\na\n```\n:::a\nb', options()), + '
a\n
\n' + ) + } ) - assert.equal( - micromark('::a{b="ađź’šb"}', options()), - '', - 'should support most other characters in quoted attribute values' + await t.test( + 'should support code (indented) before a container', + async function () { + assert.equal( + micromark(' a\n:::a\nb', options()), + '
a\n
\n' + ) + } ) - assert.equal( - micromark('::a{b="\nc\r d"}', options()), - '

::a{b="\nc\rd"}

', - 'should not support EOLs in quoted attribute values' + await t.test( + 'should support a definition before a container', + async function () { + assert.equal(micromark('[a]: b\n:::a\nb', options()), '') + } ) - assert.equal( - micromark('::a{b="c"', options()), - '

::a{b="c"

', - 'should not support an EOF after a quoted attribute value' + await t.test( + 'should support a heading (atx) before a container', + async function () { + assert.equal(micromark('# a\n:::a\nb', options()), '

a

\n') + } ) - assert.equal( - micromark('::a{b=c} \t ', options()), - '', - 'should support whitespace after directives' + await t.test( + 'should support a heading (setext) before a container', + async function () { + assert.equal(micromark('a\n=\n:::a\nb', options()), '

a

\n') + } ) - assert.equal( - micromark('::a{b=c}\n>a', options()), - '
\n

a

\n
', - 'should support a block quote after a leaf' + await t.test('should support html before a container', async function () { + assert.equal(micromark('\n:::a\nb', options()), '\n') + }) + + await t.test('should support a list before a container', async function () { + assert.equal( + micromark('* a\n:::a\nb', options()), + '
    \n
  • a
  • \n
\n' + ) + }) + + await t.test( + 'should support a paragraph before a container', + async function () { + assert.equal(micromark('a\n:::a\nb', options()), '

a

\n') + } ) - assert.equal( - micromark('::a{b=c}\n```js\na', options()), - '
a\n
\n', - 'should support code (fenced) after a leaf' + await t.test( + 'should support a thematic break before a container', + async function () { + assert.equal(micromark('***\n:::a\nb', options()), '
\n') + } ) - assert.equal( - micromark('::a{b=c}\n a', options()), - '
a\n
', - 'should support code (indented) after a leaf' - ) + await t.test('should support prefixed containers (1)', async function () { + assert.equal(micromark(' :::x\n ', options({'*': h})), '') + }) - assert.equal( - micromark('::a{b=c}\n[a]: b', options()), - '', - 'should support a definition after a leaf' - ) + await t.test('should support prefixed containers (2)', async function () { + assert.equal( + micromark(' :::x\n - a', options({'*': h})), + '\n
    \n
  • a
  • \n
\n
' + ) + }) - assert.equal( - micromark('::a{b=c}\n# a', options()), - '

a

', - 'should support a heading (atx) after a leaf' - ) + await t.test('should support prefixed containers (3)', async function () { + assert.equal( + micromark(' :::x\n - a\n > b', options({'*': h})), + '\n
    \n
  • a
  • \n
\n
\n

b

\n
\n
' + ) + }) - assert.equal( - micromark('::a{b=c}\na\n=', options()), - '

a

', - 'should support a heading (setext) after a leaf' - ) + await t.test('should support prefixed containers (4)', async function () { + assert.equal( + micromark(' :::x\n - a\n > b\n :::', options({'*': h})), + '\n
    \n
  • a
  • \n
\n
\n

b

\n
\n
' + ) + }) - assert.equal( - micromark('::a{b=c}\n', options()), - '', - 'should support html after a leaf' - ) + await t.test('should not support lazyness (1)', async function () { + assert.equal( + micromark('> :::a\nb', options({'*': h})), + '
\n
\n

b

' + ) + }) - assert.equal( - micromark('::a{b=c}\n* a', options()), - '
    \n
  • a
  • \n
', - 'should support a list after a leaf' - ) + await t.test('should not support lazyness (2)', async function () { + assert.equal( + micromark('> :::a\n> b\nc', options({'*': h})), + '
\n

b

\n
\n
\n

c

' + ) + }) - assert.equal( - micromark('::a{b=c}\na', options()), - '

a

', - 'should support a paragraph after a leaf' - ) + await t.test('should not support lazyness (3)', async function () { + assert.equal( + micromark('> a\n:::b', options({'*': h})), + '
\n

a

\n
\n' + ) + }) - assert.equal( - micromark('::a{b=c}\n***', options()), - '
', - 'should support a thematic break after a leaf' - ) - - assert.equal( - micromark('>a\n::a{b=c}', options()), - '
\n

a

\n
\n', - 'should support a block quote before a leaf' - ) - - assert.equal( - micromark('```js\na\n```\n::a{b=c}', options()), - '
a\n
\n', - 'should support code (fenced) before a leaf' - ) - - assert.equal( - micromark(' a\n::a{b=c}', options()), - '
a\n
\n', - 'should support code (indented) before a leaf' - ) - - assert.equal( - micromark('[a]: b\n::a{b=c}', options()), - '', - 'should support a definition before a leaf' - ) - - assert.equal( - micromark('# a\n::a{b=c}', options()), - '

a

\n', - 'should support a heading (atx) before a leaf' - ) - - assert.equal( - micromark('a\n=\n::a{b=c}', options()), - '

a

\n', - 'should support a heading (setext) before a leaf' - ) - - assert.equal( - micromark('\n::a{b=c}', options()), - '\n', - 'should support html before a leaf' - ) - - assert.equal( - micromark('* a\n::a{b=c}', options()), - '
    \n
  • a
  • \n
\n', - 'should support a list before a leaf' - ) - - assert.equal( - micromark('a\n::a{b=c}', options()), - '

a

\n', - 'should support a paragraph before a leaf' - ) - - assert.equal( - micromark('***\n::a{b=c}', options()), - '
\n', - 'should support a thematic break before a leaf' - ) - - assert.equal( - micromark('> ::a\nb', options({'*': h})), - '
\n
\n

b

', - 'should not support lazyness (1)' - ) - - assert.equal( - micromark('> a\n::b', options({'*': h})), - '
\n

a

\n
\n', - 'should not support lazyness (2)' - ) + await t.test('should not support lazyness (4)', async function () { + assert.equal( + micromark('> :::a\n:::', options({'*': h})), + '
\n
\n

:::

' + ) + }) }) -test('micromark-extension-directive (syntax, container)', () => { - assert.equal(micromark(':::b', options()), '', 'should support a directive') - - assert.equal( - micromark(':', options()), - '

:

', - 'should not support one colon' - ) - - assert.equal( - micromark('::', options()), - '

::

', - 'should not support two colons not followed by an alpha' - ) - - assert.equal( - micromark(':::', options()), - '

:::

', - 'should not support three colons not followed by an alpha' - ) - - assert.equal( - micromark(':::a', options()), - '', - 'should support three colons followed by an alpha' - ) - - assert.equal( - micromark(':::9', options()), - '

:::9

', - 'should not support three colons followed by a digit' - ) - - assert.equal( - micromark(':::-', options()), - '

:::-

', - 'should not support three colons followed by a dash' - ) - - assert.equal( - micromark(':::a9', options()), - '', - 'should support a digit in a name' - ) - - assert.equal( - micromark(':::a-b', options()), - '', - 'should support a dash in a name' - ) - - assert.equal( - micromark(':::a[', options()), - '

:::a[

', - 'should not support a name followed by an unclosed `[`' - ) - - assert.equal( - micromark(':::a{', options()), - '

:::a{

', - 'should not support a name followed by an unclosed `{`' - ) - - assert.equal( - micromark(':::a[b', options()), - '

:::a[b

', - 'should not support a name followed by an unclosed `[` w/ content' - ) - - assert.equal( - micromark(':::a{b', options()), - '

:::a{b

', - 'should not support a name followed by an unclosed `{` w/ content' - ) - - assert.equal( - micromark(':::a[]', options()), - '', - 'should support an empty label' - ) - - assert.equal( - micromark(':::a[ \t]', options()), - '', - 'should support a whitespace only label' - ) - - assert.equal( - micromark(':::a[\n]', options()), - '

:::a[\n]

', - 'should not support an eol in an label' - ) - - assert.equal( - micromark(':::a[a b c]', options()), - '', - 'should support content in an label' - ) - - assert.equal( - micromark(':::a[a *b* c]', options()), - '', - 'should support markdown in an label' - ) - - assert.equal( - micromark(':::a[]asd', options()), - '

:::a[]asd

', - 'should not support content after a label' - ) - - assert.equal( - micromark(':::a{}', options()), - '', - 'should support empty attributes' - ) - - assert.equal( - micromark(':::a{ \t}', options()), - '', - 'should support whitespace only attributes' - ) - - assert.equal( - micromark(':::a{\n}', options()), - '

:::a{\n}

', - 'should not support an eol in attributes' - ) - - assert.equal( - micromark(':::a{a b c}', options()), - '', - 'should support attributes' - ) - - assert.equal( - micromark(':::a{f =\rg}', options()), - '

:::a{f =\rg}

', - 'should not support EOLs around initializers' - ) - - assert.equal( - micromark(':::a{b="c', options()), - '

:::a{b="c

', - 'should not support an EOF in a quoted attribute value' - ) - - assert.equal( - micromark(':::a{b="\nc\r d"}', options()), - '

:::a{b="\nc\rd"}

', - 'should not support EOLs in quoted attribute values' - ) - - assert.equal( - micromark(':::a{b="c"', options()), - '

:::a{b="c"

', - 'should not support an EOF after a quoted attribute value' - ) - - assert.equal( - micromark(':::a{b=c} \t ', options()), - '', - 'should support whitespace after directives' - ) - - assert.equal( - micromark(':::a\n', options()), - '', - 'should support no closing fence' - ) - - assert.equal( - micromark(':::a\n:::', options()), - '', - 'should support an immediate closing fence' - ) - - assert.equal( - micromark(':::a\n:::\nb', options()), - '

b

', - 'should support content after a closing fence' - ) - - assert.equal( - micromark(':::a\n::\nb', options()), - '', - 'should not close w/ a “closing” fence of two colons' - ) - - assert.equal( - micromark(':::a\n::::\nb', options()), - '

b

', - 'should close w/ a closing fence of more colons' - ) - - assert.equal( - micromark('::::a\n::::\nb', options()), - '

b

', - 'should support more opening colons' - ) - - assert.equal( - micromark(':::::a\n::::\nb', options()), - '', - 'should not close w/ a “closing” fence of less colons than the opening' - ) - - assert.equal( - micromark(':::a\n::: \t\nc', options()), - '

c

', - 'should close w/ a closing fence followed by white space' - ) - - assert.equal( - micromark(':::a\n::: b\nc', options()), - '', - 'should not close w/ a “closing” fence followed by other characters' - ) - - assert.equal( - micromark(':::a\n :::\nc', options()), - '

c

', - 'should close w/ an indented closing fence' - ) - - assert.equal( - micromark(':::a\n\t:::\nc', options()), - '', - 'should not close w/ when the “closing” fence is indented at a tab size' - ) - - assert.equal( - micromark(':::a\n :::\nc', options()), - '', - 'should not close w/ when the “closing” fence is indented more than a tab size' - ) - - assert.equal( - micromark(':::a\n\n \n\ta', options()), - '', - 'should support blank lines in content' - ) - - assert.equal( - micromark(':::a\n\ta\n', options()), - '', - 'should support an EOL EOF' - ) - - assert.equal( - micromark(' :::a\n b\n :::\nc', options()), - '

c

', - 'should support an indented directive' - ) - - assert.equal( - micromark(' :::a\n\t:::\nc', options()), - '', - 'should still not close an indented directive when the “closing” fence is indented a tab size' - ) - - assert.equal( - micromark(':::a\n:::\n>a', options()), - '
\n

a

\n
', - 'should support a block quote after a container' - ) - - assert.equal( - micromark(':::a\n:::\n```js\na', options()), - '
a\n
\n', - 'should support code (fenced) after a container' - ) - - assert.equal( - micromark(':::a\n:::\n a', options()), - '
a\n
', - 'should support code (indented) after a container' - ) - - assert.equal( - micromark(':::a\n:::\n[a]: b', options()), - '', - 'should support a definition after a container' - ) - - assert.equal( - micromark(':::a\n:::\n# a', options()), - '

a

', - 'should support a heading (atx) after a container' - ) - - assert.equal( - micromark(':::a\n:::\na\n=', options()), - '

a

', - 'should support a heading (setext) after a container' - ) - - assert.equal( - micromark(':::a\n:::\n', options()), - '', - 'should support html after a container' - ) - - assert.equal( - micromark(':::a\n:::\n* a', options()), - '
    \n
  • a
  • \n
', - 'should support a list after a container' - ) - - assert.equal( - micromark(':::a\n:::\na', options()), - '

a

', - 'should support a paragraph after a container' - ) - - assert.equal( - micromark(':::a\n:::\n***', options()), - '
', - 'should support a thematic break after a container' - ) - - assert.equal( - micromark('>a\n:::a\nb', options()), - '
\n

a

\n
\n', - 'should support a block quote before a container' - ) - - assert.equal( - micromark('```js\na\n```\n:::a\nb', options()), - '
a\n
\n', - 'should support code (fenced) before a container' - ) - - assert.equal( - micromark(' a\n:::a\nb', options()), - '
a\n
\n', - 'should support code (indented) before a container' - ) - - assert.equal( - micromark('[a]: b\n:::a\nb', options()), - '', - 'should support a definition before a container' - ) - - assert.equal( - micromark('# a\n:::a\nb', options()), - '

a

\n', - 'should support a heading (atx) before a container' - ) - - assert.equal( - micromark('a\n=\n:::a\nb', options()), - '

a

\n', - 'should support a heading (setext) before a container' - ) - - assert.equal( - micromark('\n:::a\nb', options()), - '\n', - 'should support html before a container' - ) - - assert.equal( - micromark('* a\n:::a\nb', options()), - '
    \n
  • a
  • \n
\n', - 'should support a list before a container' - ) - - assert.equal( - micromark('a\n:::a\nb', options()), - '

a

\n', - 'should support a paragraph before a container' - ) - - assert.equal( - micromark('***\n:::a\nb', options()), - '
\n', - 'should support a thematic break before a container' - ) - - assert.equal( - micromark(' :::x\n ', options({'*': h})), - '', - 'should support prefixed containers (1)' - ) - - assert.equal( - micromark(' :::x\n - a', options({'*': h})), - '\n
    \n
  • a
  • \n
\n
', - 'should support prefixed containers (2)' - ) - - assert.equal( - micromark(' :::x\n - a\n > b', options({'*': h})), - '\n
    \n
  • a
  • \n
\n
\n

b

\n
\n
', - 'should support prefixed containers (3)' - ) - - assert.equal( - micromark(' :::x\n - a\n > b\n :::', options({'*': h})), - '\n
    \n
  • a
  • \n
\n
\n

b

\n
\n
', - 'should support prefixed containers (4)' - ) - - assert.equal( - micromark('> :::a\nb', options({'*': h})), - '
\n
\n

b

', - 'should not support lazyness (1)' - ) - - assert.equal( - micromark('> :::a\n> b\nc', options({'*': h})), - '
\n

b

\n
\n
\n

c

', - 'should not support lazyness (2)' - ) - - assert.equal( - micromark('> a\n:::b', options({'*': h})), - '
\n

a

\n
\n', - 'should not support lazyness (3)' - ) - - assert.equal( - micromark('> :::a\n:::', options({'*': h})), - '
\n
\n

:::

', - 'should not support lazyness (4)' - ) -}) - -test('micromark-extension-directive (compile)', () => { - assert.equal( - micromark( +test('micromark-extension-directive (compile)', async function (t) { + await t.test('should support a directives (abbr)', async function () { + assert.equal( + micromark( + [ + ':abbr', + ':abbr[HTML]', + ':abbr{title="HyperText Markup Language"}', + ':abbr[HTML]{title="HyperText Markup Language"}' + ].join('\n\n'), + options({abbr}) + ), [ - ':abbr', - ':abbr[HTML]', - ':abbr{title="HyperText Markup Language"}', - ':abbr[HTML]{title="HyperText Markup Language"}' - ].join('\n\n'), - options({abbr}) - ), - [ - '

', - '

HTML

', - '

', - '

HTML

' - ].join('\n'), - 'should support a directives (abbr)' - ) + '

', + '

HTML

', + '

', + '

HTML

' + ].join('\n') + ) + }) - assert.equal( - micromark( + await t.test('should support directives (youtube)', async function () { + assert.equal( + micromark( + [ + 'Text:', + ':youtube', + ':youtube[Cat in a box a]', + ':youtube{v=1}', + ':youtube[Cat in a box b]{v=2}', + 'Leaf:', + '::youtube', + '::youtube[Cat in a box c]', + '::youtube{v=3}', + '::youtube[Cat in a box d]{v=4}', + 'Container:', + ':::youtube\nw\n:::', + ':::youtube[Cat in a box e]\nx\n:::', + ':::youtube{v=5}\ny\n:::', + ':::youtube[Cat in a box f]{v=6}\nz\n:::' + ].join('\n\n'), + options({youtube}) + ), [ - 'Text:', - ':youtube', - ':youtube[Cat in a box a]', - ':youtube{v=1}', - ':youtube[Cat in a box b]{v=2}', - 'Leaf:', - '::youtube', - '::youtube[Cat in a box c]', - '::youtube{v=3}', - '::youtube[Cat in a box d]{v=4}', - 'Container:', - ':::youtube\nw\n:::', - ':::youtube[Cat in a box e]\nx\n:::', - ':::youtube{v=5}\ny\n:::', - ':::youtube[Cat in a box f]{v=6}\nz\n:::' - ].join('\n\n'), - options({youtube}) - ), - [ - '

Text:

', - '

', - '

', - '

', - '

', - '

Leaf:

', - '', - '', - '

Container:

', - '', - '' - ].join('\n'), - 'should support directives (youtube)' + '

Text:

', + '

', + '

', + '

', + '

', + '

Leaf:

', + '', + '', + '

Container:

', + '', + '' + ].join('\n') + ) + }) + + await t.test( + 'should support fall through directives (`*`)', + async function () { + assert.equal( + micromark(':youtube[Cat in a box]\n:br', options({youtube, '*': h})), + '

Cat in a box\n

' + ) + } ) - assert.equal( - micromark(':youtube[Cat in a box]\n:br', options({youtube, '*': h})), - '

Cat in a box\n

', - 'should support fall through directives (`*`)' - ) - - assert.equal( - micromark(':a[:img{src="x" alt=y}]{href="z"}', options({'*': h})), - '

y

', - 'should support fall through directives (`*`)' + await t.test( + 'should support fall through directives (`*`)', + async function () { + assert.equal( + micromark(':a[:img{src="x" alt=y}]{href="z"}', options({'*': h})), + '

y

' + ) + } ) }) -test('content', () => { - assert.equal( - micromark(':abbr[x\\&y&z]', options({abbr})), - '

x&y&z

', - 'should support character escapes and character references in label' +test('content', async function (t) { + await t.test( + 'should support character escapes and character references in label', + async function () { + assert.equal( + micromark(':abbr[x\\&y&z]', options({abbr})), + '

x&y&z

' + ) + } ) - assert.equal( - micromark(':abbr[x\\[y\\]z]', options({abbr})), - '

x[y]z

', - 'should support escaped brackets in a label' + await t.test('should support escaped brackets in a label', async function () { + assert.equal( + micromark(':abbr[x\\[y\\]z]', options({abbr})), + '

x[y]z

' + ) + }) + + await t.test( + 'should support balanced brackets in a label', + async function () { + assert.equal( + micromark(':abbr[x[y]z]', options({abbr})), + '

x[y]z

' + ) + } ) - assert.equal( - micromark(':abbr[x[y]z]', options({abbr})), - '

x[y]z

', - 'should support balanced brackets in a label' + await t.test( + 'should support balanced brackets in a label, 32 levels deep', + async function () { + assert.equal( + micromark( + ':abbr[1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', + options({abbr}) + ), + '

1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

' + ) + } ) - assert.equal( - micromark( - ':abbr[1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', - options({abbr}) - ), - '

1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

', - 'should support balanced brackets in a label, 32 levels deep' + await t.test( + 'should *not* support balanced brackets in a label, 33 levels deep', + async function () { + assert.equal( + micromark( + ':abbr[1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[33[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', + options({abbr}) + ), + '

[1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[33[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

' + ) + } ) - assert.equal( - micromark( - ':abbr[1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[33[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]', - options({abbr}) - ), - '

[1[2[3[4[5[6[7[8[9[10[11[12[13[14[15[16[17[18[19[20[21[22[23[24[25[26[27[28[29[30[31[32[33[x]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

', - 'should *not* support balanced brackets in a label, 33 levels deep' + await t.test('should support EOLs in a label', async function () { + assert.equal( + micromark(':abbr[a\nb\rc]', options({abbr})), + '

a\nb\rc

' + ) + }) + + await t.test( + 'should support EOLs at the edges of a label (1)', + async function () { + assert.equal( + micromark(':abbr[\na\r]', options({abbr})), + '

\na\r

' + ) + } ) - assert.equal( - micromark(':abbr[a\nb\rc]', options({abbr})), - '

a\nb\rc

', - 'should support EOLs in a label' + await t.test( + 'should support EOLs at the edges of a label (2)', + async function () { + assert.equal( + micromark(':abbr[\n]', options({abbr})), + '

\n

' + ) + } ) - assert.equal( - micromark(':abbr[\na\r]', options({abbr})), - '

\na\r

', - 'should support EOLs at the edges of a label (1)' + await t.test( + 'should support EOLs around nested directives', + async function () { + assert.equal( + micromark(':abbr[a\n:abbr[b]\nc]', options({abbr})), + '

a\nb\nc

' + ) + } ) - assert.equal( - micromark(':abbr[\n]', options({abbr})), - '

\n

', - 'should support EOLs at the edges of a label (2)' + await t.test( + 'should support EOLs inside nested directives (1)', + async function () { + assert.equal( + micromark(':abbr[:abbr[\n]]', options({abbr})), + '

\n

' + ) + } ) - assert.equal( - micromark(':abbr[a\n:abbr[b]\nc]', options({abbr})), - '

a\nb\nc

', - 'should support EOLs around nested directives' + await t.test( + 'should support EOLs inside nested directives (2)', + async function () { + assert.equal( + micromark(':abbr[:abbr[a\nb]]', options({abbr})), + '

a\nb

' + ) + } ) - assert.equal( - micromark(':abbr[:abbr[\n]]', options({abbr})), - '

\n

', - 'should support EOLs inside nested directives (1)' + await t.test( + 'should support EOLs inside nested directives (3)', + async function () { + assert.equal( + micromark(':abbr[:abbr[\nb\n]]', options({abbr})), + '

\nb\n

' + ) + } ) - assert.equal( - micromark(':abbr[:abbr[a\nb]]', options({abbr})), - '

a\nb

', - 'should support EOLs inside nested directives (2)' + await t.test( + 'should support EOLs inside nested directives (4)', + async function () { + assert.equal( + micromark(':abbr[:abbr[\\\n]]', options({abbr})), + '


\n

' + ) + } ) - assert.equal( - micromark(':abbr[:abbr[\nb\n]]', options({abbr})), - '

\nb\n

', - 'should support EOLs inside nested directives (3)' + await t.test('should support markdown in a label', async function () { + assert.equal( + micromark(':abbr[a *b* **c** d]', options({abbr})), + '

a b c d

' + ) + }) + + await t.test( + 'should support character references in unquoted attribute values', + async function () { + assert.equal( + micromark(':abbr{title=a'b}', options({abbr})), + '

' + ) + } ) - assert.equal( - micromark(':abbr[:abbr[\\\n]]', options({abbr})), - '


\n

', - 'should support EOLs inside nested directives (4)' + await t.test( + 'should support character references in double attribute values', + async function () { + assert.equal( + micromark(':abbr{title="a'b"}', options({abbr})), + '

' + ) + } ) - assert.equal( - micromark(':abbr[a *b* **c** d]', options({abbr})), - '

a b c d

', - 'should support markdown in a label' + await t.test( + 'should support character references in single attribute values', + async function () { + assert.equal( + micromark(":abbr{title='a'b'}", options({abbr})), + '

' + ) + } ) - assert.equal( - micromark(':abbr{title=a'b}', options({abbr})), - '

', - 'should support character references in unquoted attribute values' + await t.test( + 'should support unknown character references in attribute values', + async function () { + assert.equal( + micromark(':abbr{title="a&somethingelse;b"}', options({abbr})), + '

' + ) + } ) - assert.equal( - micromark(':abbr{title="a'b"}', options({abbr})), - '

', - 'should support character references in double attribute values' + await t.test( + 'should not support non-terminated character references in unquoted attribute values', + async function () { + assert.equal( + micromark(':a{href=¶m}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(":abbr{title='a'b'}", options({abbr})), - '

', - 'should support character references in single attribute values' + await t.test( + 'should not support non-terminated character references in double quoted attribute values', + async function () { + assert.equal( + micromark(':a{href="¶m"}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':abbr{title="a&somethingelse;b"}', options({abbr})), - '

', - 'should support unknown character references in attribute values' + await t.test( + 'should not support non-terminated character references in single quoted attribute values', + async function () { + assert.equal( + micromark(":a{href='¶m'}", options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':a{href=¶m}', options({'*': h})), - '

', - 'should not support non-terminated character references in unquoted attribute values' + await t.test('should support EOLs between attributes', async function () { + assert.equal( + micromark(':span{a\nb}', options({'*': h})), + '

' + ) + }) + + await t.test( + 'should support EOLs at the edges of attributes', + async function () { + assert.equal( + micromark(':span{\na\n}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':a{href="¶m"}', options({'*': h})), - '

', - 'should not support non-terminated character references in double quoted attribute values' + await t.test('should support EOLs before initializer', async function () { + assert.equal( + micromark(':span{a\r= b}', options({'*': h})), + '

' + ) + }) + + await t.test('should support EOLs after initializer', async function () { + assert.equal( + micromark(':span{a=\r\nb}', options({'*': h})), + '

' + ) + }) + + await t.test( + 'should support EOLs between an unquoted attribute value and a next attribute name', + async function () { + assert.equal( + micromark(':span{a=b\nc}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(":a{href='¶m'}", options({'*': h})), - '

', - 'should not support non-terminated character references in single quoted attribute values' + await t.test( + 'should support EOLs in a double quoted attribute value', + async function () { + assert.equal( + micromark(':span{a="b\nc"}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':span{a\nb}', options({'*': h})), - '

', - 'should support EOLs between attributes' + await t.test( + 'should support EOLs in a single quoted attribute value', + async function () { + assert.equal( + micromark(":span{a='b\nc'}", options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':span{\na\n}', options({'*': h})), - '

', - 'should support EOLs at the edges of attributes' + await t.test('should support `id` shortcuts', async function () { + assert.equal( + micromark(':span{#a#b}', options({'*': h})), + '

' + ) + }) + + await t.test( + 'should support `id` shortcuts after `id` attributes', + async function () { + assert.equal( + micromark(':span{id=a id="b" #c#d}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':span{a\r= b}', options({'*': h})), - '

', - 'should support EOLs before initializer' + await t.test('should support `class` shortcuts', async function () { + assert.equal( + micromark(':span{.a.b}', options({'*': h})), + '

' + ) + }) + + await t.test( + 'should support `class` shortcuts after `class` attributes', + async function () { + assert.equal( + micromark(':span{class=a class="b c" .d.e}', options({'*': h})), + '

' + ) + } ) - assert.equal( - micromark(':span{a=\r\nb}', options({'*': h})), - '

', - 'should support EOLs after initializer' + await t.test( + 'should support container directives in container directives', + async function () { + assert.equal( + micromark('::::div{.big}\n:::div{.small}\nText', options({'*': h})), + '
\n
\n

Text

\n
\n
' + ) + } ) - assert.equal( - micromark(':span{a=b\nc}', options({'*': h})), - '

', - 'should support EOLs between an unquoted attribute value and a next attribute name' + await t.test( + 'should support leaf directives in container directives', + async function () { + assert.equal( + micromark(':::div{.big}\n::hr{.small}', options({'*': h})), + '
\n
\n
' + ) + } ) - assert.equal( - micromark(':span{a="b\nc"}', options({'*': h})), - '

', - 'should support EOLs in a double quoted attribute value' + await t.test( + 'should support text directives in container directives', + async function () { + assert.equal( + micromark(':::div{.big}\n:b[Text]', options({'*': h})), + '
\n

Text

\n
' + ) + } ) - assert.equal( - micromark(":span{a='b\nc'}", options({'*': h})), - '

', - 'should support EOLs in a single quoted attribute value' + await t.test( + 'should support lists in container directives', + async function () { + assert.equal( + micromark(':::section\n* a\n:::', options({'*': h})), + '
\n
    \n
  • a
  • \n
\n
' + ) + } ) - assert.equal( - micromark(':span{#a#b}', options({'*': h})), - '

', - 'should support `id` shortcuts' + await t.test( + 'should support lists w/ label brackets in container directives', + async function () { + assert.equal( + micromark(':::section[]\n* a\n:::', options({'*': h})), + '
\n
    \n
  • a
  • \n
\n
' + ) + } ) - assert.equal( - micromark(':span{id=a id="b" #c#d}', options({'*': h})), - '

', - 'should support `id` shortcuts after `id` attributes' + await t.test( + 'should support lists w/ attribute braces in container directives', + async function () { + assert.equal( + micromark(':::section{}\n* a\n:::', options({'*': h})), + '
\n
    \n
  • a
  • \n
\n
' + ) + } ) - assert.equal( - micromark(':span{.a.b}', options({'*': h})), - '

', - 'should support `class` shortcuts' - ) - - assert.equal( - micromark(':span{class=a class="b c" .d.e}', options({'*': h})), - '

', - 'should support `class` shortcuts after `class` attributes' - ) - - assert.equal( - micromark('::::div{.big}\n:::div{.small}\nText', options({'*': h})), - '
\n
\n

Text

\n
\n
', - 'should support container directives in container directives' - ) - - assert.equal( - micromark(':::div{.big}\n::hr{.small}', options({'*': h})), - '
\n
\n
', - 'should support leaf directives in container directives' - ) - - assert.equal( - micromark(':::div{.big}\n:b[Text]', options({'*': h})), - '
\n

Text

\n
', - 'should support text directives in container directives' - ) - - assert.equal( - micromark(':::section\n* a\n:::', options({'*': h})), - '
\n
    \n
  • a
  • \n
\n
', - 'should support lists in container directives' - ) - - assert.equal( - micromark(':::section[]\n* a\n:::', options({'*': h})), - '
\n
    \n
  • a
  • \n
\n
', - 'should support lists w/ label brackets in container directives' - ) - - assert.equal( - micromark(':::section{}\n* a\n:::', options({'*': h})), - '
\n
    \n
  • a
  • \n
\n
', - 'should support lists w/ attribute braces in container directives' - ) - - assert.equal( - micromark(':::i\n- +\na', options()), - '', - 'should support lazy containers in an unclosed container directive' + await t.test( + 'should support lazy containers in an unclosed container directive', + async function () { + assert.equal(micromark(':::i\n- +\na', options()), '') + } ) }) @@ -1546,7 +1706,7 @@ function youtube(d) { function h(d) { const content = d.content || d.label const attrs = d.attributes || {} - /** @type {Array.} */ + /** @type {Array} */ const list = [] /** @type {string} */ let prop @@ -1571,12 +1731,13 @@ function h(d) { } /** - * @param {HtmlOptions} [options] + * @param {HtmlOptions | null | undefined} [options={}] + * HTML configuration (default: `{}`). */ function options(options) { return { allowDangerousHtml: true, - extensions: [syntax()], - htmlExtensions: [html(options)] + extensions: [directive()], + htmlExtensions: [directiveHtml(options)] } }