From e55aa2a8b7a36c76d175dec01293c095f7717b7b Mon Sep 17 00:00:00 2001
From: Titus Wormer :a : a ::b : :9 :- :_ :a- :a_ :a: :+1: :heart: :call_me_hand: :directive [ { [b {b asd asd a g asd {..b} {.#b} {.} {.a=b} {.a"b}
{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' + ) + }) + + await t.test('should support code (fenced) after a leaf', async function () { + assert.equal( + micromark('::a{b=c}\n```js\na', options()), + 'a
\n
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()), '{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
') + }) + + await t.test( + 'should support a thematic break after a leaf', + async function () { + assert.equal(micromark('::a{b=c}\n***', options()), '\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
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()), '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()), '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()), + 'a
\n') + }) + + await t.test( + 'should support a thematic break before a leaf', + async function () { + assert.equal(micromark('***\n::a{b=c}', 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\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()), - 'a
\n
:
', - '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' + ) + } ) - 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
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{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()), + '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()), '\n\n' + ) + } ) - assert.equal( - micromark('::a{b="c', options()), - 'a
\n
::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()), '\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()), + 'a
\n
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()), '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})), '\n\nb
\n
\n\nb
\n
\n\n
b
' + ) + }) - assert.equal( - micromark('::a{b=c}\n* a', options()), - '\n\nb
\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\n' + ) + }) - assert.equal( - micromark('::a{b=c}\n***', options()), - 'a
\n
\n\n', - 'should support a block quote before a leaf' - ) - - assert.equal( - micromark('```js\na\n```\n::a{b=c}', options()), - 'a
\n
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 paragraph before a leaf' - ) - - assert.equal( - micromark('***\n::a{b=c}', options()), - '\n\n
b
', - 'should not support lazyness (1)' - ) - - assert.equal( - micromark('> a\n::b', options({'*': h})), - '\n\n', - 'should not support lazyness (2)' - ) + await t.test('should not support lazyness (4)', async function () { + assert.equal( + micromark('> :::a\n:::', options({'*': h})), + 'a
\n
\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', - 'should support a block quote after a container' - ) - - assert.equal( - micromark(':::a\n:::\n```js\na', options()), - 'a
\n
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 paragraph after a container' - ) - - assert.equal( - micromark(':::a\n:::\n***', options()), - '\n\n', - 'should support a block quote before a container' - ) - - assert.equal( - micromark('```js\na\n```\n:::a\nb', options()), - 'a
\n
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 paragraph before a container' - ) - - assert.equal( - micromark('***\n:::a\nb', options()), - '\n\nb
\n
\n\nb
\n
\n\n
b
', - 'should not support lazyness (1)' - ) - - assert.equal( - micromark('> :::a\n> b\nc', options({'*': h})), - '\n\nb
\n\n
c
', - 'should not support lazyness (2)' - ) - - assert.equal( - micromark('> a\n:::b', options({'*': h})), - '\n\n', - 'should not support lazyness (3)' - ) - - assert.equal( - micromark('> :::a\n:::', options({'*': h})), - 'a
\n
\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})), + '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
\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
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})), + '
Text
\n', - '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})), + '
', - '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})), + '
Text
\n', - '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})), + '
', - '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})), + '
', - '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})), + '
', - '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})), - '
Text
\nText
\n