|
@@ -5,1048 +5,837 @@
|
|
|
|
|
|
|
|
import { htmlVoidElements } from 'html-void-elements';
|
|
import { htmlVoidElements } from 'html-void-elements';
|
|
|
import { micromark } from 'micromark';
|
|
import { micromark } from 'micromark';
|
|
|
-import test from 'tape';
|
|
|
|
|
|
|
+import { describe, it, expect } from 'vitest';
|
|
|
|
|
|
|
|
-import { DirectiveType } from '../src/mdast-util-growi-directive/consts.js';
|
|
|
|
|
|
|
+import { DirectiveType } from '../src/mdast-util-growi-directive/lib/index.js';
|
|
|
import { directive as syntax, directiveHtml as html } from '../src/micromark-extension-growi-directive/index.js';
|
|
import { directive as syntax, directiveHtml as html } from '../src/micromark-extension-growi-directive/index.js';
|
|
|
|
|
|
|
|
|
|
+
|
|
|
const own = {}.hasOwnProperty;
|
|
const own = {}.hasOwnProperty;
|
|
|
|
|
|
|
|
-test('micromark-extension-directive (syntax)', (t) => {
|
|
|
|
|
- t.test('text', (t) => {
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('\\$a', options()),
|
|
|
|
|
- '<p>$a</p>',
|
|
|
|
|
- 'should support an escaped colon which would otherwise be a directive',
|
|
|
|
|
- );
|
|
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('\\$$a', options()),
|
|
|
|
|
- '<p>$</p>',
|
|
|
|
|
- 'should support a directive after an escaped colon',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+describe('micromark-extension-directive (syntax)', () => {
|
|
|
|
|
+ describe('text', () => {
|
|
|
|
|
+ it('should support an escaped colon which would otherwise be a directive', () => {
|
|
|
|
|
+ expect(micromark('\\$a', options())).toBe('<p>$a</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('a :$b', options()),
|
|
|
|
|
- // '<p>a :$b</p>',
|
|
|
|
|
- // 'should not support a directive after a colon',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support a directive after an escaped colon', () => {
|
|
|
|
|
+ expect(micromark('\\$$a', options())).toBe('<p>$</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$', options()),
|
|
|
|
|
- '<p>$</p>',
|
|
|
|
|
- 'should not support a colon not followed by an alpha',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // it('should not support a directive after a colon', () => {
|
|
|
|
|
+ // expect(micromark('a :$b', options())).toBe('<p>a :$b</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support a colon followed by an alpha',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support a colon not followed by an alpha', () => {
|
|
|
|
|
+ expect(micromark('$', options())).toBe('<p>$</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$9', options()),
|
|
|
|
|
- '<p>$9</p>',
|
|
|
|
|
- 'should not support a colon followed by a digit',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a colon followed by an alpha', () => {
|
|
|
|
|
+ expect(micromark('a $a', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$-', options()),
|
|
|
|
|
- '<p>$-</p>',
|
|
|
|
|
- 'should not support a colon followed by a dash',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support a colon followed by a digit', () => {
|
|
|
|
|
+ expect(micromark('$9', options())).toBe('<p>$9</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$_', options()),
|
|
|
|
|
- '<p>$_</p>',
|
|
|
|
|
- 'should not support a colon followed by an underscore',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support a colon followed by a dash', () => {
|
|
|
|
|
+ expect(micromark('$-', options())).toBe('<p>$-</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a9', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support a digit in a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support a colon followed by an underscore', () => {
|
|
|
|
|
+ expect(micromark('$_', options())).toBe('<p>$_</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a-b', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support a dash in a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a digit in a name', () => {
|
|
|
|
|
+ expect(micromark('a $a9', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a-', options()),
|
|
|
|
|
- '<p>$a-</p>',
|
|
|
|
|
- 'should *not* support a dash at the end of a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a dash in a name', () => {
|
|
|
|
|
+ expect(micromark('a $a-b', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a_b', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support an underscore in a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should *not* support a dash at the end of a name', () => {
|
|
|
|
|
+ expect(micromark('$a-', options())).toBe('<p>$a-</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a_', options()),
|
|
|
|
|
- '<p>$a_</p>',
|
|
|
|
|
- 'should *not* support an underscore at the end of a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support an underscore in a name', () => {
|
|
|
|
|
+ expect(micromark('a $a_b', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a$', options()),
|
|
|
|
|
- '<p>$a$</p>',
|
|
|
|
|
- 'should *not* support a colon right after a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should *not* support an underscore at the end of a name', () => {
|
|
|
|
|
+ expect(micromark('$a_', options())).toBe('<p>$a_</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('_$directive_', options()),
|
|
|
|
|
- '<p><em>$directive</em></p>',
|
|
|
|
|
- 'should not interfere w/ emphasis (`_`)',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should *not* support a colon right after a name', () => {
|
|
|
|
|
+ expect(micromark('$a$', options())).toBe('<p>$a$</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[', options()),
|
|
|
|
|
- '<p>[</p>',
|
|
|
|
|
- 'should support a name followed by an unclosed `[`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not interfere w/ emphasis (`_`)', () => {
|
|
|
|
|
+ expect(micromark('_$directive_', options())).toBe('<p><em>$directive</em></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(', options()),
|
|
|
|
|
- '<p>(</p>',
|
|
|
|
|
- 'should support a name followed by an unclosed `(`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a name followed by an unclosed `[`', () => {
|
|
|
|
|
+ expect(micromark('$a[', options())).toBe('<p>[</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[b', options()),
|
|
|
|
|
- '<p>[b</p>',
|
|
|
|
|
- 'should support a name followed by an unclosed `[` w/ content',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a name followed by an unclosed `(`', () => {
|
|
|
|
|
+ expect(micromark('$a(', options())).toBe('<p>(</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b', options()),
|
|
|
|
|
- '<p>(b</p>',
|
|
|
|
|
- 'should support a name followed by an unclosed `(` w/ content',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a name followed by an unclosed `[` w/ content', () => {
|
|
|
|
|
+ expect(micromark('$a[b', options())).toBe('<p>[b</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a[]', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support an empty label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a name followed by an unclosed `(` w/ content', () => {
|
|
|
|
|
+ expect(micromark('$a(b', options())).toBe('<p>(b</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a[ \t]', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support a whitespace only label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support an empty label', () => {
|
|
|
|
|
+ expect(micromark('a $a[]', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[\n]', options()),
|
|
|
|
|
- '<p></p>',
|
|
|
|
|
- 'should support an eol in an label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a whitespace only label', () => {
|
|
|
|
|
+ expect(micromark('a $a[ \t]', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[a b c]asd', options()),
|
|
|
|
|
- '<p>asd</p>',
|
|
|
|
|
- 'should support content in an label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support an eol in an label', () => {
|
|
|
|
|
+ expect(micromark('$a[\n]', options())).toBe('<p></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[a *b* c]asd', options()),
|
|
|
|
|
- '<p>asd</p>',
|
|
|
|
|
- 'should support markdown in an label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support content in an label', () => {
|
|
|
|
|
+ expect(micromark('$a[a b c]asd', options())).toBe('<p>asd</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $b[c :d[e] f] g', options()),
|
|
|
|
|
- '<p>a g</p>',
|
|
|
|
|
- 'should support a directive in an label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support markdown in an label', () => {
|
|
|
|
|
+ expect(micromark('$a[a *b* c]asd', options())).toBe('<p>asd</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[]asd', options()),
|
|
|
|
|
- '<p>asd</p>',
|
|
|
|
|
- 'should support content after a label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // t.equal(
|
|
|
|
|
+ // micromark('$a[]asd', options()),
|
|
|
|
|
+ // '<p>$a[]asd</p>',
|
|
|
|
|
+ // 'should not support content after a label',
|
|
|
|
|
+ // );
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a()', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support empty attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a directive in an label', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $b[c :d[e] f] g', options()),
|
|
|
|
|
+ ).toBe('<p>a g</p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support content after a label', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('$a[]asd', options()),
|
|
|
|
|
+ ).toBe('<p>asd</p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support empty attributes', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a()', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support whitespace only attributes', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a( \t)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support an eol in attributes', () => {
|
|
|
|
|
+ expect(micromark('$a(\n)', options())).toBe('<p></p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/o values', () => {
|
|
|
|
|
+ expect(micromark('a $a(a b c)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/ unquoted values', () => {
|
|
|
|
|
+ expect(micromark('a $a(a=b c=d)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/ class shortcut', () => {
|
|
|
|
|
+ expect(micromark('a $a(.a .b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/ class shortcut w/o whitespace between', () => {
|
|
|
|
|
+ expect(micromark('a $a(.a.b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/ id shortcut', () => {
|
|
|
|
|
+ expect(micromark('a $a(#a #b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/ id shortcut w/o whitespace between', () => {
|
|
|
|
|
+ expect(micromark('a $a(#a#b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attributes w/ shortcuts combined w/ other attributes', () => {
|
|
|
|
|
+ expect(micromark('a $a(#a.b.c#d e f=g #h.i.j)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attrs which starts w/ continuous dots', () => {
|
|
|
|
|
+ expect(micromark('a $a(..b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attrs which start w/ `#`', () => {
|
|
|
|
|
+ expect(micromark('a $a(.#b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support attrs w/ (`.`)', () => {
|
|
|
|
|
+ expect(micromark('a $a(.)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support with the attr `(.a=b)`', () => {
|
|
|
|
|
+ expect(micromark('a $a(.a=b)', options())).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support with the attr `(.a"b)`', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(.a"b)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support with the attr `(.a<b)`', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(.a<b)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support most characters in shortcuts', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(.a💚b)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support an underscore in attribute names', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(_)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support a colon in attribute names', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(xml:lang)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support double quoted attributes', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(a="b" c="d e f")', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support single quoted attributes', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark("a $a(a='b' c='d e f')", options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support whitespace around initializers', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(a = b c\t=\t\'d\' f =\r"g")', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should not support `=` to start an unquoted attribute value', () => {
|
|
|
|
|
+ expect(micromark('$a(b==)', options())).toBe('<p>(b==)</p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should not support a missing attribute value after `=`', () => {
|
|
|
|
|
+ expect(micromark('$a(b=)', options())).toBe('<p>(b=)</p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should not support an apostrophe in an unquoted attribute value', () => {
|
|
|
|
|
+ expect(micromark("$a(b=c')", options())).toBe("<p>(b=c')</p>");
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should not support a grave accent in an unquoted attribute value', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c`)', options())).toBe('<p>(b=c`)</p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support most other characters in attribute keys', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(b💚=a💚b)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support most other characters in unquoted attribute values', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(b=a💚b)', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should not support an EOF in a quoted attribute value', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('$a(b="c', options()),
|
|
|
|
|
+ ).toBe('<p>(b="c</p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support most other characters in quoted attribute values', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a(b="a💚b")', options()),
|
|
|
|
|
+ ).toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support EOLs in quoted attribute values', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('$a(b="\nc\r d")', options()),
|
|
|
|
|
+ ).toBe(
|
|
|
|
|
+ '<p></p>',
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should not support an EOF after a quoted attribute value', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('$a(b="c"', options()),
|
|
|
|
|
+ ).toBe(
|
|
|
|
|
+ '<p>(b="c"</p>',
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a( \t)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support whitespace only attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(\n)', options()),
|
|
|
|
|
- '<p></p>',
|
|
|
|
|
- 'should support an eol in attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ describe('leaf', () => {
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(a b c)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/o values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a directive', () => {
|
|
|
|
|
+ expect(micromark('$b', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(a=b c=d)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/ unquoted values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support one colon', () => {
|
|
|
|
|
+ expect(micromark(':', options())).toBe('<p>:</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.a .b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/ class shortcut',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support two colons not followed by an alpha', () => {
|
|
|
|
|
+ expect(micromark('::', options())).toBe('<p>::</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.a.b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/ class shortcut w/o whitespace between',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support two colons followed by an alpha', () => {
|
|
|
|
|
+ expect(micromark('$a', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(#a #b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/ id shortcut',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support two colons followed by a digit', () => {
|
|
|
|
|
+ expect(micromark('$9', options())).toBe('<p>$9</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(#a#b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/ id shortcut w/o whitespace between',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support two colons followed by a dash', () => {
|
|
|
|
|
+ expect(micromark('$-', options())).toBe('<p>$-</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(#a.b.c#d e f=g #h.i.j)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attributes w/ shortcuts combined w/ other attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a digit in a name', () => {
|
|
|
|
|
+ expect(micromark('$a9', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(..b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attrs which starts w/ continuous dots',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a dash in a name', () => {
|
|
|
|
|
+ expect(micromark('$a-b', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.#b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attrs which start w/ `#`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support a name followed by an unclosed `[`', () => {
|
|
|
|
|
+ // expect(micromark('$a[', options())).toBe('<p>$a[</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support attrs w/ (`.`)',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support a name followed by an unclosed `{`', () => {
|
|
|
|
|
+ // expect(micromark('$a{', options())).toBe('<p>$a{</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.a=b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support with the attr `(.a=b)`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support a name followed by an unclosed `[` w/ content', () => {
|
|
|
|
|
+ // expect(micromark('$a[b', options())).toBe('<p>$a[b</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.a"b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support with the attr `(.a"b)`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support a name followed by an unclosed `{` w/ content', () => {
|
|
|
|
|
+ // expect(micromark('$a{b', options())).toBe('<p>$a{b</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.a<b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support with the attr `(.a<b)`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support an empty label', () => {
|
|
|
|
|
+ expect(micromark('$a[]', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(.a💚b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support most characters in shortcuts',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a whitespace only label', () => {
|
|
|
|
|
+ expect(micromark('$a[ \t]', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(_)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support an underscore in attribute names',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support an eol in an label', () => {
|
|
|
|
|
+ // expect(micromark('$a[\n]', options())).toBe('<p>$a[\n]</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(xml:lang)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support a colon in attribute names',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support content in an label', () => {
|
|
|
|
|
+ expect(micromark('$a[a b c]', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(a="b" c="d e f")', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support double quoted attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support markdown in an label', () => {
|
|
|
|
|
+ expect(micromark('$a[a *b* c]', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark("a $a(a='b' c='d e f')", options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support single quoted attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support content after a label', () => {
|
|
|
|
|
+ // expect(micromark('$a[]asd', options())).toBe('<p>$a[]asd</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(a = b c\t=\t\'d\' f =\r"g")', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support whitespace around initializers',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support empty attributes', () => {
|
|
|
|
|
+ expect(micromark('$a()', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b==)', options()),
|
|
|
|
|
- '<p>(b==)</p>',
|
|
|
|
|
- 'should not support `=` to start an unquoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support whitespace only attributes', () => {
|
|
|
|
|
+ expect(micromark('$a( \t)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=)', options()),
|
|
|
|
|
- '<p>(b=)</p>',
|
|
|
|
|
- 'should not support a missing attribute value after `=`',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support an eol in attributes', () => {
|
|
|
|
|
+ // expect(micromark('$a(\n)', options())).toBe('<p>$a(\n)</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark("$a(b=c')", options()),
|
|
|
|
|
- "<p>(b=c')</p>",
|
|
|
|
|
- 'should not support an apostrophe in an unquoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attributes w/o values', () => {
|
|
|
|
|
+ expect(micromark('$a(a b c)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c`)', options()),
|
|
|
|
|
- '<p>(b=c`)</p>',
|
|
|
|
|
- 'should not support a grave accent in an unquoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attributes w/ unquoted values', () => {
|
|
|
|
|
+ expect(micromark('$a(a=b c=d)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(b💚=a💚b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support most other characters in attribute keys',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attributes w/ class shortcut', () => {
|
|
|
|
|
+ expect(micromark('$a(.a .b)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(b=a💚b)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support most other characters in unquoted attribute values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attributes w/ id shortcut', () => {
|
|
|
|
|
+ expect(micromark('$a(#a #b)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b="c', options()),
|
|
|
|
|
- '<p>(b="c</p>',
|
|
|
|
|
- 'should not support an EOF in a quoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support most characters in shortcuts', () => {
|
|
|
|
|
+ expect(micromark('$a(.a💚b)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a(b="a💚b")', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support most other characters in quoted attribute values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support double quoted attributes', () => {
|
|
|
|
|
+ expect(micromark('$a(a="b" c="d e f")', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b="\nc\r d")', options()),
|
|
|
|
|
- '<p></p>',
|
|
|
|
|
- 'should support EOLs in quoted attribute values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support single quoted attributes', () => {
|
|
|
|
|
+ expect(micromark("$a(a='b' c='d e f')", options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b="c"', options()),
|
|
|
|
|
- '<p>(b="c"</p>',
|
|
|
|
|
- 'should not support an EOF after a quoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support whitespace around initializers', () => {
|
|
|
|
|
+ expect(micromark("$a(a = b c\t=\t'd')", options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.end();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support EOLs around initializers', () => {
|
|
|
|
|
+ // expect(micromark('$a(f =\rg)', options())).toBe('<p>$a(f =\rg)</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.test('leaf', (t) => {
|
|
|
|
|
- t.equal(micromark('$b', options()), '', 'should support a directive');
|
|
|
|
|
|
|
+ // == Resolved as text directive
|
|
|
|
|
+ // it('should not support `=` to start an unquoted attribute value', () => {
|
|
|
|
|
+ // expect(micromark('$a(b==)', options())).toBe('<p>$a(b==)</p>');
|
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark(':', options()),
|
|
|
|
|
- '<p>:</p>',
|
|
|
|
|
- 'should not support one colon',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support most other characters in attribute keys', () => {
|
|
|
|
|
+ expect(micromark('$a(b💚=a💚b)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('::', options()),
|
|
|
|
|
- '<p>::</p>',
|
|
|
|
|
- 'should not support two colons not followed by an alpha',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support most other characters in unquoted attribute values', () => {
|
|
|
|
|
+ expect(micromark('$a(b=a💚b)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support two colons followed by an alpha',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support an EOF in a quoted attribute value', () => {
|
|
|
|
|
+ expect(micromark('$a(b="c', options())).toBe('<p>(b="c</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$9', options()),
|
|
|
|
|
- '<p>$9</p>',
|
|
|
|
|
- 'should not support two colons followed by a digit',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support most other characters in quoted attribute values', () => {
|
|
|
|
|
+ expect(micromark('$a(b="a💚b")', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$-', options()),
|
|
|
|
|
- '<p>$-</p>',
|
|
|
|
|
- 'should not support two colons followed by a dash',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support EOLs in quoted attribute values', () => {
|
|
|
|
|
+ expect(micromark('$a(b="\nc\r d")', options())).toBe('<p></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a9', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support a digit in a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support an EOF after a quoted attribute value', () => {
|
|
|
|
|
+ expect(micromark('$a(b="c"', options())).toBe('<p>(b="c"</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a-b', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support a dash in a name',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support whitespace after directives', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c) \t ', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a[', options()),
|
|
|
|
|
- // '<p>$a[</p>',
|
|
|
|
|
- // 'should not support a name followed by an unclosed `[`',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support a block quote after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n>a', options())).toBe('<blockquote>\n<p>a</p>\n</blockquote>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a{', options()),
|
|
|
|
|
- // '<p>$a{</p>',
|
|
|
|
|
- // 'should not support a name followed by an unclosed `{`',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support code (fenced) after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n```js\na', options())).toBe('<pre><code class="language-js">a\n</code></pre>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a[b', options()),
|
|
|
|
|
- // '<p>$a[b</p>',
|
|
|
|
|
- // 'should not support a name followed by an unclosed `[` w/ content',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support code (indented) after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n a', options())).toBe('<pre><code>a\n</code></pre>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a{b', options()),
|
|
|
|
|
- // '<p>$a{b</p>',
|
|
|
|
|
- // 'should not support a name followed by an unclosed `{` w/ content',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support a definition after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n[a]: b', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(micromark('$a[]', options()), '', 'should support an empty label');
|
|
|
|
|
|
|
+ it('should support a heading (atx) after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n# a', options())).toBe('<h1>a</h1>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[ \t]', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support a whitespace only label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a heading (setext) after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\na\n=', options())).toBe('<h1>a</h1>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a[\n]', options()),
|
|
|
|
|
- // '<p>$a[\n]</p>',
|
|
|
|
|
- // 'should not support an eol in an label',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support html after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n<!-->', options())).toBe('<!-->');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[a b c]', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support content in an label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a list after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n* a', options())).toBe('<ul>\n<li>a</li>\n</ul>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a[a *b* c]', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support markdown in an label',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a paragraph after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\na', options())).toBe('<p>a</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a[]asd', options()),
|
|
|
|
|
- // '<p>$a[]asd</p>',
|
|
|
|
|
- // 'should not support content after a label',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support a thematic break after a leaf', () => {
|
|
|
|
|
+ expect(micromark('$a(b=c)\n***', options())).toBe('<hr />');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a()', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support empty attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a block quote before a leaf', () => {
|
|
|
|
|
+ expect(micromark('>a\n$a(b=c)', options())).toBe('<blockquote>\n<p>a</p>\n</blockquote>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a( \t)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support whitespace only attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support code (fenced) before a leaf', () => {
|
|
|
|
|
+ expect(micromark('```js\na\n```\n$a(b=c)', options())).toBe('<pre><code class="language-js">a\n</code></pre>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a(\n)', options()),
|
|
|
|
|
- // '<p>$a(\n)</p>',
|
|
|
|
|
- // 'should not support an eol in attributes',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should support code (indented) before a leaf', () => {
|
|
|
|
|
+ expect(micromark(' a\n$a(b=c)', options())).toBe('<pre><code>a\n</code></pre>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(a b c)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support attributes w/o values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a definition before a leaf', () => {
|
|
|
|
|
+ expect(micromark('[a]: b\n$a(b=c)', options())).toBe('');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(a=b c=d)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support attributes w/ unquoted values',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a heading (atx) before a leaf', () => {
|
|
|
|
|
+ expect(micromark('# a\n$a(b=c)', options())).toBe('<h1>a</h1>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(.a .b)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support attributes w/ class shortcut',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a heading (setext) before a leaf', () => {
|
|
|
|
|
+ expect(micromark('a\n=\n$a(b=c)', options())).toBe('<h1>a</h1>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(#a #b)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support attributes w/ id shortcut',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support html before a leaf', () => {
|
|
|
|
|
+ expect(micromark('<!-->\n$a(b=c)', options())).toBe('<!-->\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(.a💚b)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support most characters in shortcuts',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a list before a leaf', () => {
|
|
|
|
|
+ expect(micromark('* a\n$a(b=c)', options())).toBe('<ul>\n<li>a</li>\n</ul>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(a="b" c="d e f")', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support double quoted attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a paragraph before a leaf', () => {
|
|
|
|
|
+ expect(micromark('a\n$a(b=c)', options())).toBe('<p>a</p>\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark("$a(a='b' c='d e f')", options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support single quoted attributes',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support a thematic break before a leaf', () => {
|
|
|
|
|
+ expect(micromark('***\n$a(b=c)', options())).toBe('<hr />\n');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark("$a(a = b c\t=\t'd')", options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support whitespace around initializers',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should not support lazyness (1)', () => {
|
|
|
|
|
+ expect(micromark('> $a\nb', options({ '*': h }))).toBe('<blockquote><a></a>\n</blockquote>\n<p>b</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a(f =\rg)', options()),
|
|
|
|
|
- // '<p>$a(f =\rg)</p>',
|
|
|
|
|
- // 'should not support EOLs around initializers',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ it('should not support lazyness (2)', () => {
|
|
|
|
|
+ expect(micromark('> a\n$b', options({ '*': h }))).toBe('<blockquote>\n<p>a</p>\n</blockquote>\n<b></b>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a(b==)', options()),
|
|
|
|
|
- // '<p>$a(b==)</p>',
|
|
|
|
|
- // 'should not support `=` to start an unquoted attribute value',
|
|
|
|
|
- // );
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b💚=a💚b)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support most other characters in attribute keys',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=a💚b)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support most other characters in unquoted attribute values',
|
|
|
|
|
|
|
+describe('micromark-extension-directive (compile)', () => {
|
|
|
|
|
+
|
|
|
|
|
+ it('should support a directives (abbr)', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'a $abbr',
|
|
|
|
|
+ 'a $abbr[HTML]',
|
|
|
|
|
+ 'a $abbr(title="HyperText Markup Language")',
|
|
|
|
|
+ 'a $abbr[HTML](title="HyperText Markup Language")',
|
|
|
|
|
+ ].join('\n\n'),
|
|
|
|
|
+ options({ abbr }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ).toBe(
|
|
|
|
|
+ [
|
|
|
|
|
+ '<p>a <abbr></abbr></p>',
|
|
|
|
|
+ '<p>a <abbr>HTML</abbr></p>',
|
|
|
|
|
+ '<p>a <abbr title="HyperText Markup Language"></abbr></p>',
|
|
|
|
|
+ '<p>a <abbr title="HyperText Markup Language">HTML</abbr></p>',
|
|
|
|
|
+ ].join('\n'),
|
|
|
);
|
|
);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a(b="c', options()),
|
|
|
|
|
- // '<p>$a(b="c</p>',
|
|
|
|
|
- // 'should not support an EOF in a quoted attribute value',
|
|
|
|
|
- // );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b="a💚b")', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support most other characters in quoted attribute values',
|
|
|
|
|
|
|
+ it('should support directives (youtube)', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'Text:',
|
|
|
|
|
+ 'a $youtube',
|
|
|
|
|
+ 'a $youtube[Cat in a box a]',
|
|
|
|
|
+ 'a $youtube(v=1)',
|
|
|
|
|
+ 'a $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)',
|
|
|
|
|
+ ].join('\n\n'),
|
|
|
|
|
+ options({ youtube }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ).toBe(
|
|
|
|
|
+ [
|
|
|
|
|
+ '<p>Text:</p>',
|
|
|
|
|
+ '<p>a </p>',
|
|
|
|
|
+ '<p>a </p>',
|
|
|
|
|
+ '<p>a <iframe src="https://www.youtube.com/embed/1" allowfullscreen></iframe></p>',
|
|
|
|
|
+ '<p>a <iframe src="https://www.youtube.com/embed/2" allowfullscreen title="Cat in a box b"></iframe></p>',
|
|
|
|
|
+ '<p>Leaf:</p>',
|
|
|
|
|
+ '<iframe src="https://www.youtube.com/embed/3" allowfullscreen></iframe>',
|
|
|
|
|
+ '<iframe src="https://www.youtube.com/embed/4" allowfullscreen title="Cat in a box d"></iframe>',
|
|
|
|
|
+ ].join('\n'),
|
|
|
);
|
|
);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == Resolved as text directive
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a(b="\nc\r d")', options()),
|
|
|
|
|
- // '<p>$a(b="\nc\rd")</p>',
|
|
|
|
|
- // 'should not support EOLs in quoted attribute values',
|
|
|
|
|
- // );
|
|
|
|
|
-
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$a(b="c"', options()),
|
|
|
|
|
- // '<p>$a(b="c"</p>',
|
|
|
|
|
- // 'should not support an EOF after a quoted attribute value',
|
|
|
|
|
- // );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c) \t ', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support whitespace after directives',
|
|
|
|
|
|
|
+ it('should support directives (lsx)', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark(
|
|
|
|
|
+ [
|
|
|
|
|
+ 'Text:',
|
|
|
|
|
+ 'a $lsx',
|
|
|
|
|
+ 'a $lsx()',
|
|
|
|
|
+ 'a $lsx(num=1)',
|
|
|
|
|
+ 'a $lsx(/)',
|
|
|
|
|
+ 'a $lsx(/,num=5,depth=1)',
|
|
|
|
|
+ 'a $lsx(/, num=5, depth=1)',
|
|
|
|
|
+ 'a $lsx(💚)',
|
|
|
|
|
+ 'Leaf:',
|
|
|
|
|
+ '$lsx',
|
|
|
|
|
+ '$lsx()',
|
|
|
|
|
+ '$lsx(num=1)',
|
|
|
|
|
+ '$lsx(/)',
|
|
|
|
|
+ '$lsx(/,num=5,depth=1)',
|
|
|
|
|
+ '$lsx(/, num=5, depth=1)',
|
|
|
|
|
+ '$lsx(💚)',
|
|
|
|
|
+ ].join('\n\n'),
|
|
|
|
|
+ options({ lsx }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ).toBe(
|
|
|
|
|
+ [
|
|
|
|
|
+ '<p>Text:</p>',
|
|
|
|
|
+ '<p>a <lsx ></lsx></p>',
|
|
|
|
|
+ '<p>a <lsx ></lsx></p>',
|
|
|
|
|
+ '<p>a <lsx num="1"></lsx></p>',
|
|
|
|
|
+ '<p>a <lsx prefix="/"></lsx></p>',
|
|
|
|
|
+ '<p>a <lsx prefix="/" num="5" depth="1"></lsx></p>',
|
|
|
|
|
+ '<p>a <lsx prefix="/" num="5" depth="1"></lsx></p>',
|
|
|
|
|
+ '<p>a <lsx prefix="💚"></lsx></p>',
|
|
|
|
|
+ '<p>Leaf:</p>',
|
|
|
|
|
+ '<lsx ></lsx>',
|
|
|
|
|
+ '<lsx ></lsx>',
|
|
|
|
|
+ '<lsx num="1"></lsx>',
|
|
|
|
|
+ '<lsx prefix="/"></lsx>',
|
|
|
|
|
+ '<lsx prefix="/" num="5" depth="1"></lsx>',
|
|
|
|
|
+ '<lsx prefix="/" num="5" depth="1"></lsx>',
|
|
|
|
|
+ '<lsx prefix="💚"></lsx>',
|
|
|
|
|
+ ].join('\n'),
|
|
|
);
|
|
);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n>a', options()),
|
|
|
|
|
- '<blockquote>\n<p>a</p>\n</blockquote>',
|
|
|
|
|
- 'should support a block quote after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support fall through directives (`*`)', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $youtube[Cat in a box]\n$br a', options({ youtube, '*': h })),
|
|
|
|
|
+ ).toBe('<p>a <youtube>Cat in a box</youtube>\n<br> a</p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n```js\na', options()),
|
|
|
|
|
- '<pre><code class="language-js">a\n</code></pre>\n',
|
|
|
|
|
- 'should support code (fenced) after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support fall through directives (`*`)', () => {
|
|
|
|
|
+ expect(
|
|
|
|
|
+ micromark('a $a[$img(src="x" alt=y)](href="z")', options({ '*': h })),
|
|
|
|
|
+ ).toBe('<p>a <a href="z"><img src="x" alt="y"></a></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n a', options()),
|
|
|
|
|
- '<pre><code>a\n</code></pre>',
|
|
|
|
|
- 'should support code (indented) after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n[a]: b', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support a definition after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+describe('content', () => {
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n# a', options()),
|
|
|
|
|
- '<h1>a</h1>',
|
|
|
|
|
- 'should support a heading (atx) after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support character escapes and character references in label', () => {
|
|
|
|
|
+ expect(micromark('a $abbr[x\\&y&z]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr>x&y&z</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\na\n=', options()),
|
|
|
|
|
- '<h1>a</h1>',
|
|
|
|
|
- 'should support a heading (setext) after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support escaped brackets in a label', () => {
|
|
|
|
|
+ expect(micromark('a $abbr[x\\[y\\]z]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr>x[y]z</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n<!-->', options()),
|
|
|
|
|
- '<!-->',
|
|
|
|
|
- 'should support html after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support balanced brackets in a label', () => {
|
|
|
|
|
+ expect(micromark('a $abbr[x[y]z]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr>x[y]z</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n* a', options()),
|
|
|
|
|
- '<ul>\n<li>a</li>\n</ul>',
|
|
|
|
|
- 'should support a list after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support balanced brackets in a label, 32 levels deep', () => {
|
|
|
|
|
+ expect(micromark(
|
|
|
|
|
+ 'a $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 }),
|
|
|
|
|
+ )).toBe('<p>a <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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\na', options()),
|
|
|
|
|
- '<p>a</p>',
|
|
|
|
|
- 'should support a paragraph after a leaf',
|
|
|
|
|
|
|
+ it('should *not* support balanced brackets in a label, 33 levels deep', () => {
|
|
|
|
|
+ expect(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 }),
|
|
|
|
|
+ )).toBe(
|
|
|
|
|
+ '<p><abbr></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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]</p>',
|
|
|
);
|
|
);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$a(b=c)\n***', options()),
|
|
|
|
|
- '<hr />',
|
|
|
|
|
- 'should support a thematic break after a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs in a label', () => {
|
|
|
|
|
+ expect(micromark('$abbr[a\nb\rc]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr>a\nb\rc</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('>a\n$a(b=c)', options()),
|
|
|
|
|
- '<blockquote>\n<p>a</p>\n</blockquote>\n',
|
|
|
|
|
- 'should support a block quote before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs at the edges of a label (1)', () => {
|
|
|
|
|
+ expect(micromark('$abbr[\na\r]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr>\na\r</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('```js\na\n```\n$a(b=c)', options()),
|
|
|
|
|
- '<pre><code class="language-js">a\n</code></pre>\n',
|
|
|
|
|
- 'should support code (fenced) before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs at the edges of a label (2)', () => {
|
|
|
|
|
+ expect(micromark('$abbr[\n]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr>\n</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark(' a\n$a(b=c)', options()),
|
|
|
|
|
- '<pre><code>a\n</code></pre>\n',
|
|
|
|
|
- 'should support code (indented) before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // == does not work but I don't know why.. -- 2022.08.12 Yuki Takei
|
|
|
|
|
+ // it('should support EOLs around nested directives', () => {
|
|
|
|
|
+ // expect(micromark('$abbr[a\n$abbr[b]\nc]', options({ abbr })))
|
|
|
|
|
+ // .toBe('<p><abbr>a\n<abbr>b</abbr>\nc</abbr></p>');
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support EOLs inside nested directives (1)', () => {
|
|
|
|
|
+ expect(micromark('$abbr[$abbr[\n]]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr><abbr>\n</abbr></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('[a]: b\n$a(b=c)', options()),
|
|
|
|
|
- '',
|
|
|
|
|
- 'should support a definition before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs inside nested directives (2)', () => {
|
|
|
|
|
+ expect(micromark('$abbr[$abbr[a\nb]]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr><abbr>a\nb</abbr></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('# a\n$a(b=c)', options()),
|
|
|
|
|
- '<h1>a</h1>\n',
|
|
|
|
|
- 'should support a heading (atx) before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs inside nested directives (3)', () => {
|
|
|
|
|
+ expect(micromark('$abbr[$abbr[\nb\n]]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr><abbr>\nb\n</abbr></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a\n=\n$a(b=c)', options()),
|
|
|
|
|
- '<h1>a</h1>\n',
|
|
|
|
|
- 'should support a heading (setext) before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs inside nested directives (4)', () => {
|
|
|
|
|
+ expect(micromark('$abbr[$abbr[\\\n]]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p><abbr><abbr><br />\n</abbr></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('<!-->\n$a(b=c)', options()),
|
|
|
|
|
- '<!-->\n',
|
|
|
|
|
- 'should support html before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support markdown in a label', () => {
|
|
|
|
|
+ expect(micromark('a $abbr[a *b* **c** d]', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr>a <em>b</em> <strong>c</strong> d</abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('* a\n$a(b=c)', options()),
|
|
|
|
|
- '<ul>\n<li>a</li>\n</ul>\n',
|
|
|
|
|
- 'should support a list before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support character references in unquoted attribute values', () => {
|
|
|
|
|
+ expect(micromark('a $abbr(title=a'b)', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr title="a\'b"></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a\n$a(b=c)', options()),
|
|
|
|
|
- '<p>a</p>\n',
|
|
|
|
|
- 'should support a paragraph before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support character references in double attribute values', () => {
|
|
|
|
|
+ expect(micromark('a $abbr(title="a'b")', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr title="a\'b"></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('***\n$a(b=c)', options()),
|
|
|
|
|
- '<hr />\n',
|
|
|
|
|
- 'should support a thematic break before a leaf',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support character references in single attribute values', () => {
|
|
|
|
|
+ expect(micromark("a $abbr(title='a'b')", options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr title="a\'b"></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('> $a\nb', options({ '*': h })),
|
|
|
|
|
- '<blockquote><a></a>\n</blockquote>\n<p>b</p>',
|
|
|
|
|
- 'should not support lazyness (1)',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support unknown character references in attribute values', () => {
|
|
|
|
|
+ expect(micromark('a $abbr(title="a&somethingelse;b")', options({ abbr })))
|
|
|
|
|
+ .toBe('<p>a <abbr title="a&somethingelse;b"></abbr></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('> a\n$b', options({ '*': h })),
|
|
|
|
|
- '<blockquote>\n<p>a</p>\n</blockquote>\n<b></b>',
|
|
|
|
|
- 'should not support lazyness (2)',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs between attributes', () => {
|
|
|
|
|
+ expect(micromark('$span(a\nb)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a="" b=""></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.end();
|
|
|
|
|
|
|
+ it('should support EOLs at the edges of attributes', () => {
|
|
|
|
|
+ expect(micromark('$span(\na\n)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a=""></span></p>');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- t.end();
|
|
|
|
|
-});
|
|
|
|
|
|
|
+ it('should support EOLs before initializer', () => {
|
|
|
|
|
+ expect(micromark('$span(a\r= b)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a="b"></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
-test('micromark-extension-directive (compile)', (t) => {
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark(
|
|
|
|
|
- [
|
|
|
|
|
- 'a $abbr',
|
|
|
|
|
- 'a $abbr[HTML]',
|
|
|
|
|
- 'a $abbr(title="HyperText Markup Language")',
|
|
|
|
|
- 'a $abbr[HTML](title="HyperText Markup Language")',
|
|
|
|
|
- ].join('\n\n'),
|
|
|
|
|
- options({ abbr }),
|
|
|
|
|
- ),
|
|
|
|
|
- [
|
|
|
|
|
- '<p>a <abbr></abbr></p>',
|
|
|
|
|
- '<p>a <abbr>HTML</abbr></p>',
|
|
|
|
|
- '<p>a <abbr title="HyperText Markup Language"></abbr></p>',
|
|
|
|
|
- '<p>a <abbr title="HyperText Markup Language">HTML</abbr></p>',
|
|
|
|
|
- ].join('\n'),
|
|
|
|
|
- 'should support a directives (abbr)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark(
|
|
|
|
|
- [
|
|
|
|
|
- 'Text:',
|
|
|
|
|
- 'a $youtube',
|
|
|
|
|
- 'a $youtube[Cat in a box a]',
|
|
|
|
|
- 'a $youtube(v=1)',
|
|
|
|
|
- 'a $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)',
|
|
|
|
|
- ].join('\n\n'),
|
|
|
|
|
- options({ youtube }),
|
|
|
|
|
- ),
|
|
|
|
|
- [
|
|
|
|
|
- '<p>Text:</p>',
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- '<p>a <iframe src="https://www.youtube.com/embed/1" allowfullscreen></iframe></p>',
|
|
|
|
|
- '<p>a <iframe src="https://www.youtube.com/embed/2" allowfullscreen title="Cat in a box b"></iframe></p>',
|
|
|
|
|
- '<p>Leaf:</p>',
|
|
|
|
|
- '<iframe src="https://www.youtube.com/embed/3" allowfullscreen></iframe>',
|
|
|
|
|
- '<iframe src="https://www.youtube.com/embed/4" allowfullscreen title="Cat in a box d"></iframe>',
|
|
|
|
|
- ].join('\n'),
|
|
|
|
|
- 'should support directives (youtube)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark(
|
|
|
|
|
- [
|
|
|
|
|
- 'Text:',
|
|
|
|
|
- 'a $lsx',
|
|
|
|
|
- 'a $lsx()',
|
|
|
|
|
- 'a $lsx(num=1)',
|
|
|
|
|
- 'a $lsx(/)',
|
|
|
|
|
- 'a $lsx(/,num=5,depth=1)',
|
|
|
|
|
- 'a $lsx(/, num=5, depth=1)',
|
|
|
|
|
- 'a $lsx(💚)',
|
|
|
|
|
- 'Leaf:',
|
|
|
|
|
- '$lsx',
|
|
|
|
|
- '$lsx()',
|
|
|
|
|
- '$lsx(num=1)',
|
|
|
|
|
- '$lsx(/)',
|
|
|
|
|
- '$lsx(/,num=5,depth=1)',
|
|
|
|
|
- '$lsx(/, num=5, depth=1)',
|
|
|
|
|
- '$lsx(💚)',
|
|
|
|
|
- ].join('\n\n'),
|
|
|
|
|
- options({ lsx }),
|
|
|
|
|
- ),
|
|
|
|
|
- [
|
|
|
|
|
- '<p>Text:</p>',
|
|
|
|
|
- '<p>a <lsx ></lsx></p>',
|
|
|
|
|
- '<p>a <lsx ></lsx></p>',
|
|
|
|
|
- '<p>a <lsx num="1"></lsx></p>',
|
|
|
|
|
- '<p>a <lsx prefix="/"></lsx></p>',
|
|
|
|
|
- '<p>a <lsx prefix="/" num="5" depth="1"></lsx></p>',
|
|
|
|
|
- '<p>a <lsx prefix="/" num="5" depth="1"></lsx></p>',
|
|
|
|
|
- '<p>a <lsx prefix="💚"></lsx></p>',
|
|
|
|
|
- '<p>Leaf:</p>',
|
|
|
|
|
- '<lsx ></lsx>',
|
|
|
|
|
- '<lsx ></lsx>',
|
|
|
|
|
- '<lsx num="1"></lsx>',
|
|
|
|
|
- '<lsx prefix="/"></lsx>',
|
|
|
|
|
- '<lsx prefix="/" num="5" depth="1"></lsx>',
|
|
|
|
|
- '<lsx prefix="/" num="5" depth="1"></lsx>',
|
|
|
|
|
- '<lsx prefix="💚"></lsx>',
|
|
|
|
|
- ].join('\n'),
|
|
|
|
|
- 'should support directives (lsx)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $youtube[Cat in a box]\n$br a', options({ youtube, '*': h })),
|
|
|
|
|
- '<p>a <youtube>Cat in a box</youtube>\n<br> a</p>',
|
|
|
|
|
- 'should support fall through directives (`*`)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $a[$img(src="x" alt=y)](href="z")', options({ '*': h })),
|
|
|
|
|
- '<p>a <a href="z"><img src="x" alt="y"></a></p>',
|
|
|
|
|
- 'should support fall through directives (`*`)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.end();
|
|
|
|
|
-});
|
|
|
|
|
|
|
+ it('should support EOLs after initializer', () => {
|
|
|
|
|
+ expect(micromark('$span(a=\r\nb)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a="b"></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
-test('content', (t) => {
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr[x\\&y&z]', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr>x&y&z</abbr></p>',
|
|
|
|
|
- 'should support character escapes and character references in label',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr[x\\[y\\]z]', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr>x[y]z</abbr></p>',
|
|
|
|
|
- 'should support escaped brackets in a label',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr[x[y]z]', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr>x[y]z</abbr></p>',
|
|
|
|
|
- 'should support balanced brackets in a label',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark(
|
|
|
|
|
- 'a $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 }),
|
|
|
|
|
- ),
|
|
|
|
|
- '<p>a <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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]</abbr></p>',
|
|
|
|
|
- 'should support balanced brackets in a label, 32 levels deep',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs between an unquoted attribute value and a next attribute name', () => {
|
|
|
|
|
+ expect(micromark('$span(a=b\nc)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a="b" c=""></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.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 }),
|
|
|
|
|
- ),
|
|
|
|
|
- '<p><abbr></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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]</p>',
|
|
|
|
|
- 'should *not* support balanced brackets in a label, 33 levels deep',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[a\nb\rc]', options({ abbr })),
|
|
|
|
|
- '<p><abbr>a\nb\rc</abbr></p>',
|
|
|
|
|
- 'should support EOLs in a label',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[\na\r]', options({ abbr })),
|
|
|
|
|
- '<p><abbr>\na\r</abbr></p>',
|
|
|
|
|
- 'should support EOLs at the edges of a label (1)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[\n]', options({ abbr })),
|
|
|
|
|
- '<p><abbr>\n</abbr></p>',
|
|
|
|
|
- 'should support EOLs at the edges of a label (2)',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs in a double quoted attribute value', () => {
|
|
|
|
|
+ expect(micromark('$span(a="b\nc")', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a="b\nc"></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // == does not work but I don't know why.. -- 2022.08.12 Yuki Takei
|
|
|
|
|
- // t.equal(
|
|
|
|
|
- // micromark('$abbr[a\n$abbr[b]\nc]', options({ abbr })),
|
|
|
|
|
- // '<p>a <abbr>a\n<abbr>b</abbr>\nc</abbr> a</p>',
|
|
|
|
|
- // 'should support EOLs around nested directives',
|
|
|
|
|
- // );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[$abbr[\n]]', options({ abbr })),
|
|
|
|
|
- '<p><abbr><abbr>\n</abbr></abbr></p>',
|
|
|
|
|
- 'should support EOLs inside nested directives (1)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[$abbr[a\nb]]', options({ abbr })),
|
|
|
|
|
- '<p><abbr><abbr>a\nb</abbr></abbr></p>',
|
|
|
|
|
- 'should support EOLs inside nested directives (2)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[$abbr[\nb\n]]', options({ abbr })),
|
|
|
|
|
- '<p><abbr><abbr>\nb\n</abbr></abbr></p>',
|
|
|
|
|
- 'should support EOLs inside nested directives (3)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$abbr[$abbr[\\\n]]', options({ abbr })),
|
|
|
|
|
- '<p><abbr><abbr><br />\n</abbr></abbr></p>',
|
|
|
|
|
- 'should support EOLs inside nested directives (4)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr[a *b* **c** d]', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr>a <em>b</em> <strong>c</strong> d</abbr></p>',
|
|
|
|
|
- 'should support markdown in a label',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr(title=a'b)', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr title="a\'b"></abbr></p>',
|
|
|
|
|
- 'should support character references in unquoted attribute values',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr(title="a'b")', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr title="a\'b"></abbr></p>',
|
|
|
|
|
- 'should support character references in double attribute values',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark("a $abbr(title='a'b')", options({ abbr })),
|
|
|
|
|
- '<p>a <abbr title="a\'b"></abbr></p>',
|
|
|
|
|
- 'should support character references in single attribute values',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $abbr(title="a&somethingelse;b")', options({ abbr })),
|
|
|
|
|
- '<p>a <abbr title="a&somethingelse;b"></abbr></p>',
|
|
|
|
|
- 'should support unknown character references in attribute values',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$span(a\nb)', options({ '*': h })),
|
|
|
|
|
- '<p><span a="" b=""></span></p>',
|
|
|
|
|
- 'should support EOLs between attributes',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$span(\na\n)', options({ '*': h })),
|
|
|
|
|
- '<p><span a=""></span></p>',
|
|
|
|
|
- 'should support EOLs at the edges of attributes',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$span(a\r= b)', options({ '*': h })),
|
|
|
|
|
- '<p><span a="b"></span></p>',
|
|
|
|
|
- 'should support EOLs before initializer',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$span(a=\r\nb)', options({ '*': h })),
|
|
|
|
|
- '<p><span a="b"></span></p>',
|
|
|
|
|
- 'should support EOLs after initializer',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$span(a=b\nc)', options({ '*': h })),
|
|
|
|
|
- '<p><span a="b" c=""></span></p>',
|
|
|
|
|
- 'should support EOLs between an unquoted attribute value and a next attribute name',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('$span(a="b\nc")', options({ '*': h })),
|
|
|
|
|
- '<p><span a="b\nc"></span></p>',
|
|
|
|
|
- 'should support EOLs in a double quoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark("$span(a='b\nc')", options({ '*': h })),
|
|
|
|
|
- '<p><span a="b\nc"></span></p>',
|
|
|
|
|
- 'should support EOLs in a single quoted attribute value',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $span(#a#b)', options({ '*': h })),
|
|
|
|
|
- '<p>a <span #a#b=""></span></p>',
|
|
|
|
|
- 'should support attrs which contains `#` (1)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $span(id=a id="b" #c#d)', options({ '*': h })),
|
|
|
|
|
- '<p>a <span id="b" #c#d=""></span></p>',
|
|
|
|
|
- 'should support attrs which contains `#` (2)',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $span(.a.b)', options({ '*': h })),
|
|
|
|
|
- '<p>a <span .a.b=""></span></p>',
|
|
|
|
|
- 'should support attrs with dot notation',
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- t.test('spec for growi plugin', (t) => {
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $lsx(/Sandbox)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support name with slash',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support EOLs in a single quoted attribute value', () => {
|
|
|
|
|
+ expect(micromark("$span(a='b\nc')", options({ '*': h })))
|
|
|
|
|
+ .toBe('<p><span a="b\nc"></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $lsx(key=value, reverse)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support name=value and an attribute w/o value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attrs which contains `#` (1)', () => {
|
|
|
|
|
+ expect(micromark('a $span(#a#b)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p>a <span #a#b=""></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $lsx(key=value, reverse, reverse2)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support consecutive attributes w/o value',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attrs which contains `#` (2)', () => {
|
|
|
|
|
+ expect(micromark('a $span(id=a id="b" #c#d)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p>a <span id="b" #c#d=""></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.equal(
|
|
|
|
|
- micromark('a $lsx(/Sandbox, key=value, reverse)', options()),
|
|
|
|
|
- '<p>a </p>',
|
|
|
|
|
- 'should support name=value after an empty value attribute',
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ it('should support attrs with dot notation', () => {
|
|
|
|
|
+ expect(micromark('a $span(.a.b)', options({ '*': h })))
|
|
|
|
|
+ .toBe('<p>a <span .a.b=""></span></p>');
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- t.end();
|
|
|
|
|
|
|
+ describe('spec for growi plugin', () => {
|
|
|
|
|
+ it('should support name with slash', () => {
|
|
|
|
|
+ expect(micromark('a $lsx(/Sandbox)', options()))
|
|
|
|
|
+ .toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support name=value and an attribute w/o value', () => {
|
|
|
|
|
+ expect(micromark('a $lsx(key=value, reverse)', options()))
|
|
|
|
|
+ .toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support consecutive attributes w/o value', () => {
|
|
|
|
|
+ expect(micromark('a $lsx(key=value, reverse, reverse2)', options()))
|
|
|
|
|
+ .toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should support name=value after an empty value attribute', () => {
|
|
|
|
|
+ expect(micromark('a $lsx(/Sandbox, key=value, reverse)', options()))
|
|
|
|
|
+ .toBe('<p>a </p>');
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- t.end();
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
/** @type {Handle} */
|
|
/** @type {Handle} */
|