|
| 1 | +export const spec = [ |
| 2 | + { |
| 3 | + category: 'Tables', |
| 4 | + input: '| foo | bar |\n| --- | --- |\n| baz | bim |\n', |
| 5 | + output: |
| 6 | + '<table>\n<thead>\n<tr>\n<th>foo</th>\n<th>bar</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>baz</td>\n<td>bim</td>\n</tr>\n</tbody>\n</table>\n' |
| 7 | + }, |
| 8 | + { |
| 9 | + category: 'Tables', |
| 10 | + input: '| abc | defghi |\n:-: | -----------:\nbar | baz\n', |
| 11 | + output: |
| 12 | + '<table>\n<thead>\n<tr>\n<th align="center">abc</th>\n<th align="right">defghi</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align="center">bar</td>\n<td align="right">baz</td>\n</tr>\n</tbody>\n</table>\n' |
| 13 | + }, |
| 14 | + { |
| 15 | + category: 'Tables', |
| 16 | + input: '| f\\|oo |\n| ------ |\n| b `\\|` az |\n| b **\\|** im |\n', |
| 17 | + output: |
| 18 | + '<table>\n<thead>\n<tr>\n<th>f|oo</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b <code>|</code> az</td>\n</tr>\n<tr>\n<td>b <strong>|</strong> im</td>\n</tr>\n</tbody>\n</table>\n' |
| 19 | + }, |
| 20 | + { |
| 21 | + category: 'Tables', |
| 22 | + input: '| abc | def |\n| --- | --- |\n| bar | baz |\n> bar\n', |
| 23 | + output: |
| 24 | + '<table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>bar</td>\n<td>baz</td>\n</tr>\n</tbody>\n</table>\n<blockquote>\n<p>bar</p>\n</blockquote>\n' |
| 25 | + }, |
| 26 | + { |
| 27 | + category: 'Tables', |
| 28 | + input: '| abc | def |\n| --- | --- |\n| bar | baz |\nbar\n\nbar\n', |
| 29 | + output: |
| 30 | + '<table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>bar</td>\n<td>baz</td>\n</tr>\n<tr>\n<td>bar</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>bar</p>\n' |
| 31 | + }, |
| 32 | + { |
| 33 | + category: 'Tables', |
| 34 | + input: '| abc | def |\n| --- |\n| bar |\n', |
| 35 | + output: '<p>| abc | def |\n| --- |\n| bar |</p>\n' |
| 36 | + }, |
| 37 | + { |
| 38 | + category: 'Tables', |
| 39 | + input: '| abc | def |\n| --- | --- |\n| bar |\n| bar | baz | boo |\n', |
| 40 | + output: |
| 41 | + '<table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>bar</td>\n<td></td>\n</tr>\n<tr>\n<td>bar</td>\n<td>baz</td>\n</tr>\n</tbody>\n</table>\n' |
| 42 | + }, |
| 43 | + { |
| 44 | + category: 'Tables', |
| 45 | + input: '| abc | def |\n| --- | --- |\n', |
| 46 | + output: |
| 47 | + '<table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n</table>\n' |
| 48 | + }, |
| 49 | + { |
| 50 | + category: 'Task list items', |
| 51 | + input: '- [ ] foo\n- [x] bar\n', |
| 52 | + output: |
| 53 | + '<ul>\n<li><input disabled="" type="checkbox"> foo</li>\n<li><input checked="" disabled="" type="checkbox"> bar</li>\n</ul>\n' |
| 54 | + }, |
| 55 | + { |
| 56 | + category: 'Task list items', |
| 57 | + input: '- [x] foo\n - [ ] bar\n - [x] baz\n- [ ] bim\n', |
| 58 | + output: |
| 59 | + '<ul>\n<li><input checked="" disabled="" type="checkbox"> foo\n<ul>\n<li><input disabled="" type="checkbox"> bar</li>\n<li><input checked="" disabled="" type="checkbox"> baz</li>\n</ul>\n</li>\n<li><input disabled="" type="checkbox"> bim</li>\n</ul>\n' |
| 60 | + }, |
| 61 | + { |
| 62 | + category: 'Strikethrough', |
| 63 | + input: '~~Hi~~ Hello, world!\n', |
| 64 | + output: '<p><del>Hi</del> Hello, world!</p>\n' |
| 65 | + }, |
| 66 | + { |
| 67 | + category: 'Strikethrough', |
| 68 | + input: 'This ~~has a\n\nnew paragraph~~.\n', |
| 69 | + output: '<p>This ~~has a</p>\n<p>new paragraph~~.</p>\n' |
| 70 | + }, |
| 71 | + { |
| 72 | + category: 'Autolinks', |
| 73 | + input: 'www.commonmark.org\n', |
| 74 | + output: |
| 75 | + '<p><a href="http://www.commonmark.org">www.commonmark.org</a></p>\n' |
| 76 | + }, |
| 77 | + { |
| 78 | + category: 'Autolinks', |
| 79 | + input: 'Visit www.commonmark.org/help for more information.\n', |
| 80 | + output: |
| 81 | + '<p>Visit <a href="http://www.commonmark.org/help">www.commonmark.org/help</a> for more information.</p>\n' |
| 82 | + }, |
| 83 | + { |
| 84 | + category: 'Autolinks', |
| 85 | + input: 'Visit www.commonmark.org.\n\nVisit www.commonmark.org/a.b.\n', |
| 86 | + output: |
| 87 | + '<p>Visit <a href="http://www.commonmark.org">www.commonmark.org</a>.</p>\n<p>Visit <a href="http://www.commonmark.org/a.b">www.commonmark.org/a.b</a>.</p>\n' |
| 88 | + }, |
| 89 | + { |
| 90 | + category: 'Autolinks', |
| 91 | + input: |
| 92 | + 'www.google.com/search?q=Markup+(business)\n\nwww.google.com/search?q=Markup+(business)))\n\n(www.google.com/search?q=Markup+(business))\n\n(www.google.com/search?q=Markup+(business)\n', |
| 93 | + output: |
| 94 | + '<p><a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>\n<p><a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a>))</p>\n<p>(<a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a>)</p>\n<p>(<a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>\n' |
| 95 | + }, |
| 96 | + { |
| 97 | + category: 'Autolinks', |
| 98 | + input: 'www.google.com/search?q=(business))+ok\n', |
| 99 | + output: |
| 100 | + '<p><a href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>\n' |
| 101 | + }, |
| 102 | + { |
| 103 | + category: 'Autolinks', |
| 104 | + input: |
| 105 | + 'www.google.com/search?q=commonmark&hl=en\n\nwww.google.com/search?q=commonmark&hl;\n', |
| 106 | + output: |
| 107 | + '<p><a href="http://www.google.com/search?q=commonmark&hl=en">www.google.com/search?q=commonmark&hl=en</a></p>\n<p><a href="http://www.google.com/search?q=commonmark">www.google.com/search?q=commonmark</a>&hl;</p>\n' |
| 108 | + }, |
| 109 | + { |
| 110 | + category: 'Autolinks', |
| 111 | + input: 'www.commonmark.org/he<lp\n', |
| 112 | + output: |
| 113 | + '<p><a href="http://www.commonmark.org/he">www.commonmark.org/he</a><lp</p>\n' |
| 114 | + }, |
| 115 | + { |
| 116 | + category: 'Autolinks', |
| 117 | + input: |
| 118 | + 'http://commonmark.org\n\n(Visit https://encrypted.google.com/search?q=Markup+(business))\n', |
| 119 | + output: |
| 120 | + '<p><a href="http://commonmark.org">http://commonmark.org</a></p>\n<p>(Visit <a href="https://encrypted.google.com/search?q=Markup+(business)">https://encrypted.google.com/search?q=Markup+(business)</a>)</p>\n' |
| 121 | + }, |
| 122 | + { |
| 123 | + category: 'Autolinks', |
| 124 | + input: 'foo@bar.baz\n', |
| 125 | + output: '<p><a href="mailto:foo@bar.baz">foo@bar.baz</a></p>\n' |
| 126 | + }, |
| 127 | + { |
| 128 | + category: 'Autolinks', |
| 129 | + input: |
| 130 | + "hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.\n", |
| 131 | + output: |
| 132 | + '<p>hello@mail+xyz.example isn\'t valid, but <a href="mailto:hello+xyz@mail.example">hello+xyz@mail.example</a> is.</p>\n' |
| 133 | + }, |
| 134 | + { |
| 135 | + category: 'Autolinks', |
| 136 | + input: 'a.b-c_d@a.b\n\na.b-c_d@a.b.\n\na.b-c_d@a.b-\n\na.b-c_d@a.b_\n', |
| 137 | + output: |
| 138 | + '<p><a href="mailto:a.b-c_d@a.b">a.b-c_d@a.b</a></p>\n<p><a href="mailto:a.b-c_d@a.b">a.b-c_d@a.b</a>.</p>\n<p>a.b-c_d@a.b-</p>\n<p>a.b-c_d@a.b_</p>\n' |
| 139 | + }, |
| 140 | + { |
| 141 | + category: 'Disallowed Raw HTML', |
| 142 | + input: |
| 143 | + '<strong> <title> <style> <em>\n\n<blockquote>\n <xmp> is disallowed. <XMP> is also disallowed.\n</blockquote>\n', |
| 144 | + output: |
| 145 | + '<p><strong> <title> <style> <em></p>\n<blockquote>\n <xmp> is disallowed. <XMP> is also disallowed.\n</blockquote>\n' |
| 146 | + } |
| 147 | +] |
0 commit comments