Skip to content

Commit 04214da

Browse files
committed
Update dev-dependencies
1 parent 0f0074a commit 04214da

File tree

3 files changed

+49
-50
lines changed

3 files changed

+49
-50
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
exports.fromMarkdown = require('./from-markdown')
2-
exports.toMarkdown = require('./to-markdown')
1+
exports.fromMarkdown = require('./from-markdown.js')
2+
exports.toMarkdown = require('./to-markdown.js')

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"remark-cli": "^9.0.0",
5555
"remark-preset-wooorm": "^8.0.0",
5656
"tape": "^5.0.0",
57-
"xo": "^0.37.0"
57+
"xo": "^0.38.0"
5858
},
5959
"scripts": {
6060
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",

test/index.js

+46-47
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,56 @@ var toHtml = require('hast-util-to-html')
77
var fromMarkdown = require('mdast-util-from-markdown')
88
var toMarkdown = require('mdast-util-to-markdown')
99
var syntax = require('micromark-extension-gfm')()
10-
var gfm = require('..')
11-
var spec = require('./spec')
10+
var gfm = require('../index.js')
11+
var spec = require('./spec.json')
1212

1313
test('markdown -> mdast', function (t) {
14-
spec
15-
.filter((example) => {
16-
return !/disallowed raw html/i.test(example.category)
14+
const files = spec.filter(
15+
(example) => !/disallowed raw html/i.test(example.category)
16+
)
17+
let index = -1
18+
19+
while (++index < files.length) {
20+
const example = files[index]
21+
var category = slug(example.category)
22+
var name = index + '-' + category
23+
var fixtureHtmlPath = path.join(__dirname, name + '.html')
24+
var fixtureMarkdownPath = path.join(__dirname, name + '.md')
25+
var fixtureHtml
26+
var fixtureMarkdown
27+
var mdast
28+
var html
29+
var md
30+
31+
mdast = fromMarkdown(example.input, {
32+
extensions: [syntax],
33+
mdastExtensions: [gfm.fromMarkdown]
1734
})
18-
.forEach((example, index) => {
19-
var category = slug(example.category)
20-
var name = index + '-' + category
21-
var fixtureHtmlPath = path.join(__dirname, name + '.html')
22-
var fixtureMarkdownPath = path.join(__dirname, name + '.md')
23-
var fixtureHtml
24-
var fixtureMarkdown
25-
var mdast
26-
var html
27-
var md
28-
29-
mdast = fromMarkdown(example.input, {
30-
extensions: [syntax],
31-
mdastExtensions: [gfm.fromMarkdown]
32-
})
33-
34-
html = toHtml(
35-
toHast(mdast, {allowDangerousHtml: true, commonmark: true}),
36-
{
37-
allowDangerousHtml: true,
38-
entities: {useNamedReferences: true},
39-
closeSelfClosing: true
40-
}
41-
)
42-
43-
try {
44-
fixtureHtml = String(fs.readFileSync(fixtureHtmlPath))
45-
} catch (_) {
46-
fixtureHtml = example.output.slice(0, -1)
47-
}
48-
49-
md = toMarkdown(mdast, {extensions: [gfm.toMarkdown()]})
50-
51-
try {
52-
fixtureMarkdown = String(fs.readFileSync(fixtureMarkdownPath))
53-
} catch (_) {
54-
fixtureMarkdown = md
55-
fs.writeFileSync(fixtureMarkdownPath, fixtureMarkdown)
56-
}
57-
58-
t.deepEqual(html, fixtureHtml, category + ' (' + index + ') -> html')
59-
t.equal(md, fixtureMarkdown, category + ' (' + index + ') -> md')
35+
36+
html = toHtml(toHast(mdast, {allowDangerousHtml: true, commonmark: true}), {
37+
allowDangerousHtml: true,
38+
entities: {useNamedReferences: true},
39+
closeSelfClosing: true
6040
})
6141

42+
try {
43+
fixtureHtml = String(fs.readFileSync(fixtureHtmlPath))
44+
} catch (_) {
45+
fixtureHtml = example.output.slice(0, -1)
46+
}
47+
48+
md = toMarkdown(mdast, {extensions: [gfm.toMarkdown()]})
49+
50+
try {
51+
fixtureMarkdown = String(fs.readFileSync(fixtureMarkdownPath))
52+
} catch (_) {
53+
fixtureMarkdown = md
54+
fs.writeFileSync(fixtureMarkdownPath, fixtureMarkdown)
55+
}
56+
57+
t.deepEqual(html, fixtureHtml, category + ' (' + index + ') -> html')
58+
t.equal(md, fixtureMarkdown, category + ' (' + index + ') -> md')
59+
}
60+
6261
t.end()
6362
})

0 commit comments

Comments
 (0)