Skip to content

Commit

Permalink
Update dev-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Oct 3, 2021
1 parent f0c4469 commit 108249d
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 130 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
"mdast-util-to-hast": "^11.0.0",
"mdast-util-to-markdown": "^1.0.0",
"micromark-extension-gfm": "^1.0.0",
"node-fetch": "^2.0.0",
"node-fetch": "^3.0.0",
"prettier": "^2.0.0",
"remark-cli": "^10.0.0",
"remark-preset-wooorm": "^9.0.0",
"rimraf": "^3.0.0",
"tape": "^5.0.0",
"type-coverage": "^2.0.0",
"typescript": "^4.0.0",
"xo": "^0.44.0"
"xo": "^0.45.0"
},
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage",
Expand Down
4 changes: 2 additions & 2 deletions script/crawl-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from 'node:path'
import fetch from 'node-fetch'

fetch(
'https://api.github.com/repos/micromark/micromark-extension-gfm/contents/test/spec.json',
'https://api.github.com/repos/micromark/micromark-extension-gfm/contents/test/spec.js',
{headers: {Accept: 'application/vnd.github.v3.raw'}}
).then((response) => {
response.body.pipe(fs.createWriteStream(path.join('test', 'spec.json')))
response.body.pipe(fs.createWriteStream(path.join('test', 'spec.js')))
})
4 changes: 2 additions & 2 deletions test/22-autolinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

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

a.b-c_d\@a.b-
a.b-c\_d\@a.b-

a.b-c_d\@a.b\_
a.b-c\_d\@a.b\_
3 changes: 1 addition & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {fromMarkdown} from 'mdast-util-from-markdown'
import {toMarkdown} from 'mdast-util-to-markdown'
import {gfm} from 'micromark-extension-gfm'
import {gfmFromMarkdown, gfmToMarkdown} from '../index.js'

const spec = JSON.parse(fs.readFileSync(path.join('test', 'spec.json')))
import {spec} from './spec.js'

test('markdown -> mdast', (t) => {
const files = spec.filter(
Expand Down
147 changes: 147 additions & 0 deletions test/spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
export const spec = [
{
category: 'Tables',
input: '| foo | bar |\n| --- | --- |\n| baz | bim |\n',
output:
'<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'
},
{
category: 'Tables',
input: '| abc | defghi |\n:-: | -----------:\nbar | baz\n',
output:
'<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'
},
{
category: 'Tables',
input: '| f\\|oo |\n| ------ |\n| b `\\|` az |\n| b **\\|** im |\n',
output:
'<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'
},
{
category: 'Tables',
input: '| abc | def |\n| --- | --- |\n| bar | baz |\n> bar\n',
output:
'<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'
},
{
category: 'Tables',
input: '| abc | def |\n| --- | --- |\n| bar | baz |\nbar\n\nbar\n',
output:
'<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'
},
{
category: 'Tables',
input: '| abc | def |\n| --- |\n| bar |\n',
output: '<p>| abc | def |\n| --- |\n| bar |</p>\n'
},
{
category: 'Tables',
input: '| abc | def |\n| --- | --- |\n| bar |\n| bar | baz | boo |\n',
output:
'<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'
},
{
category: 'Tables',
input: '| abc | def |\n| --- | --- |\n',
output:
'<table>\n<thead>\n<tr>\n<th>abc</th>\n<th>def</th>\n</tr>\n</thead>\n</table>\n'
},
{
category: 'Task list items',
input: '- [ ] foo\n- [x] bar\n',
output:
'<ul>\n<li><input disabled="" type="checkbox"> foo</li>\n<li><input checked="" disabled="" type="checkbox"> bar</li>\n</ul>\n'
},
{
category: 'Task list items',
input: '- [x] foo\n - [ ] bar\n - [x] baz\n- [ ] bim\n',
output:
'<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'
},
{
category: 'Strikethrough',
input: '~~Hi~~ Hello, world!\n',
output: '<p><del>Hi</del> Hello, world!</p>\n'
},
{
category: 'Strikethrough',
input: 'This ~~has a\n\nnew paragraph~~.\n',
output: '<p>This ~~has a</p>\n<p>new paragraph~~.</p>\n'
},
{
category: 'Autolinks',
input: 'www.commonmark.org\n',
output:
'<p><a href="http://www.commonmark.org">www.commonmark.org</a></p>\n'
},
{
category: 'Autolinks',
input: 'Visit www.commonmark.org/help for more information.\n',
output:
'<p>Visit <a href="http://www.commonmark.org/help">www.commonmark.org/help</a> for more information.</p>\n'
},
{
category: 'Autolinks',
input: 'Visit www.commonmark.org.\n\nVisit www.commonmark.org/a.b.\n',
output:
'<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'
},
{
category: 'Autolinks',
input:
'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',
output:
'<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'
},
{
category: 'Autolinks',
input: 'www.google.com/search?q=(business))+ok\n',
output:
'<p><a href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>\n'
},
{
category: 'Autolinks',
input:
'www.google.com/search?q=commonmark&hl=en\n\nwww.google.com/search?q=commonmark&hl;\n',
output:
'<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'
},
{
category: 'Autolinks',
input: 'www.commonmark.org/he<lp\n',
output:
'<p><a href="http://www.commonmark.org/he">www.commonmark.org/he</a>&lt;lp</p>\n'
},
{
category: 'Autolinks',
input:
'http://commonmark.org\n\n(Visit https://encrypted.google.com/search?q=Markup+(business))\n',
output:
'<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'
},
{
category: 'Autolinks',
input: 'foo@bar.baz\n',
output: '<p><a href="mailto:foo@bar.baz">foo@bar.baz</a></p>\n'
},
{
category: 'Autolinks',
input:
"hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.\n",
output:
'<p>hello@mail+xyz.example isn\'t valid, but <a href="mailto:hello+xyz@mail.example">hello+xyz@mail.example</a> is.</p>\n'
},
{
category: 'Autolinks',
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',
output:
'<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'
},
{
category: 'Disallowed Raw HTML',
input:
'<strong> <title> <style> <em>\n\n<blockquote>\n <xmp> is disallowed. <XMP> is also disallowed.\n</blockquote>\n',
output:
'<p><strong> &lt;title> &lt;style> <em></p>\n<blockquote>\n &lt;xmp> is disallowed. &lt;XMP> is also disallowed.\n</blockquote>\n'
}
]
122 changes: 0 additions & 122 deletions test/spec.json

This file was deleted.

0 comments on commit 108249d

Please sign in to comment.