Skip to content

Commit 378e72e

Browse files
committed
Update retext
1 parent 6d2489e commit 378e72e

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"prettier": "^2.0.0",
5353
"remark-cli": "^9.0.0",
5454
"remark-preset-wooorm": "^8.0.0",
55-
"retext": "^7.0.0",
55+
"retext": "^8.0.0",
5656
"rimraf": "^3.0.0",
5757
"strip-ansi": "^7.0.0",
5858
"tape": "^5.0.0",

test.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import strip from 'strip-ansi'
44
import {u} from 'unist-builder'
55
import {h} from 'hastscript'
66
import {x} from 'xastscript'
7-
// @ts-expect-error remove when typed.
8-
import retext from 'retext'
7+
import {retext} from 'retext'
98
import {fromXml} from 'xast-util-from-xml'
109
import {inspect, inspectColor, inspectNoColor} from './index.js'
1110

@@ -331,18 +330,29 @@ test('inspect()', (t) => {
331330

332331
test('inspectNoColor()', (t) => {
333332
t.equal(
334-
inspectNoColor(retext().parse(paragraph).children[0].children[0]),
333+
inspectNoColor(retext().parse(paragraph)),
335334
[
336-
'SentenceNode[6] (1:1-1:18, 0-17)',
337-
'├─0 WordNode[1] (1:1-1:5, 0-4)',
338-
'│ └─0 TextNode "Some" (1:1-1:5, 0-4)',
339-
'├─1 WhiteSpaceNode " " (1:5-1:6, 4-5)',
340-
'├─2 WordNode[1] (1:6-1:12, 5-11)',
341-
'│ └─0 TextNode "simple" (1:6-1:12, 5-11)',
342-
'├─3 WhiteSpaceNode " " (1:12-1:13, 11-12)',
343-
'├─4 WordNode[1] (1:13-1:17, 12-16)',
344-
'│ └─0 TextNode "text" (1:13-1:17, 12-16)',
345-
'└─5 PunctuationNode "." (1:17-1:18, 16-17)'
335+
'RootNode[1] (1:1-1:36, 0-35)\n└─0 ParagraphNode[3] (1:1-1:36, 0-35)',
336+
' ├─0 SentenceNode[6] (1:1-1:18, 0-17)',
337+
' │ ├─0 WordNode[1] (1:1-1:5, 0-4)',
338+
' │ │ └─0 TextNode "Some" (1:1-1:5, 0-4)',
339+
' │ ├─1 WhiteSpaceNode " " (1:5-1:6, 4-5)',
340+
' │ ├─2 WordNode[1] (1:6-1:12, 5-11)',
341+
' │ │ └─0 TextNode "simple" (1:6-1:12, 5-11)',
342+
' │ ├─3 WhiteSpaceNode " " (1:12-1:13, 11-12)',
343+
' │ ├─4 WordNode[1] (1:13-1:17, 12-16)',
344+
' │ │ └─0 TextNode "text" (1:13-1:17, 12-16)',
345+
' │ └─5 PunctuationNode "." (1:17-1:18, 16-17)',
346+
' ├─1 WhiteSpaceNode " " (1:18-1:19, 17-18)',
347+
' └─2 SentenceNode[6] (1:19-1:36, 18-35)',
348+
' ├─0 WordNode[1] (1:19-1:24, 18-23)',
349+
' │ └─0 TextNode "Other" (1:19-1:24, 18-23)',
350+
' ├─1 WhiteSpaceNode " " (1:24-1:25, 23-24)',
351+
' ├─2 PunctuationNode "“" (1:25-1:26, 24-25)',
352+
' ├─3 WordNode[1] (1:26-1:34, 25-33)',
353+
' │ └─0 TextNode "sentence" (1:26-1:34, 25-33)',
354+
' ├─4 PunctuationNode "”" (1:34-1:35, 33-34)',
355+
' └─5 PunctuationNode "." (1:35-1:36, 34-35)'
346356
].join('\n'),
347357
'should work'
348358
)
@@ -352,6 +362,7 @@ test('inspectNoColor()', (t) => {
352362

353363
test('inspectColor()', (t) => {
354364
t.equal(
365+
// @ts-expect-error: fine.
355366
inspectColor(retext().parse(paragraph).children[0].children[0]),
356367
[
357368
chalkEnabled.bold('SentenceNode') +

0 commit comments

Comments
 (0)