Skip to content

Commit 108249d

Browse files
committed
Update dev-dependencies
1 parent f0c4469 commit 108249d

File tree

6 files changed

+154
-130
lines changed

6 files changed

+154
-130
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353
"mdast-util-to-hast": "^11.0.0",
5454
"mdast-util-to-markdown": "^1.0.0",
5555
"micromark-extension-gfm": "^1.0.0",
56-
"node-fetch": "^2.0.0",
56+
"node-fetch": "^3.0.0",
5757
"prettier": "^2.0.0",
5858
"remark-cli": "^10.0.0",
5959
"remark-preset-wooorm": "^9.0.0",
6060
"rimraf": "^3.0.0",
6161
"tape": "^5.0.0",
6262
"type-coverage": "^2.0.0",
6363
"typescript": "^4.0.0",
64-
"xo": "^0.44.0"
64+
"xo": "^0.45.0"
6565
},
6666
"scripts": {
6767
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",

script/crawl-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import path from 'node:path'
33
import fetch from 'node-fetch'
44

55
fetch(
6-
'https://api.github.com/repos/micromark/micromark-extension-gfm/contents/test/spec.json',
6+
'https://api.github.com/repos/micromark/micromark-extension-gfm/contents/test/spec.js',
77
{headers: {Accept: 'application/vnd.github.v3.raw'}}
88
).then((response) => {
9-
response.body.pipe(fs.createWriteStream(path.join('test', 'spec.json')))
9+
response.body.pipe(fs.createWriteStream(path.join('test', 'spec.js')))
1010
})

test/22-autolinks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
<a.b-c_d@a.b>.
44

5-
a.b-c_d\@a.b-
5+
a.b-c\_d\@a.b-
66

7-
a.b-c_d\@a.b\_
7+
a.b-c\_d\@a.b\_

test/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import {fromMarkdown} from 'mdast-util-from-markdown'
88
import {toMarkdown} from 'mdast-util-to-markdown'
99
import {gfm} from 'micromark-extension-gfm'
1010
import {gfmFromMarkdown, gfmToMarkdown} from '../index.js'
11-
12-
const spec = JSON.parse(fs.readFileSync(path.join('test', 'spec.json')))
11+
import {spec} from './spec.js'
1312

1413
test('markdown -> mdast', (t) => {
1514
const files = spec.filter(

test/spec.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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&amp;hl=en">www.google.com/search?q=commonmark&amp;hl=en</a></p>\n<p><a href="http://www.google.com/search?q=commonmark">www.google.com/search?q=commonmark</a>&amp;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>&lt;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> &lt;title> &lt;style> <em></p>\n<blockquote>\n &lt;xmp> is disallowed. &lt;XMP> is also disallowed.\n</blockquote>\n'
146+
}
147+
]

test/spec.json

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)