Skip to content

Commit 7f34853

Browse files
committed
Update @types/mdast, mdast utilities
1 parent f6b8418 commit 7f34853

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

lib/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
* @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
1111
*/
1212

13-
import {containerPhrasing} from 'mdast-util-to-markdown/lib/util/container-phrasing.js'
14-
import {track} from 'mdast-util-to-markdown/lib/util/track.js'
15-
1613
// To do: next major: expose functions.
1714
// To do: next major: use `state`, state utilities.
1815

@@ -85,10 +82,10 @@ function exitStrikethrough(token) {
8582
* @param {Delete} node
8683
*/
8784
function handleDelete(node, _, context, safeOptions) {
88-
const tracker = track(safeOptions)
85+
const tracker = context.createTracker(safeOptions)
8986
const exit = context.enter('strikethrough')
9087
let value = tracker.move('~~')
91-
value += containerPhrasing(node, context, {
88+
value += context.containerPhrasing(node, {
9289
...tracker.current(),
9390
before: value,
9491
after: '~'

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@
3939
"index.js"
4040
],
4141
"dependencies": {
42-
"@types/mdast": "^3.0.0",
43-
"mdast-util-to-markdown": "^1.3.0"
42+
"@types/mdast": "^4.0.0",
43+
"mdast-util-from-markdown": "^2.0.0",
44+
"mdast-util-to-markdown": "^2.0.0"
4445
},
4546
"devDependencies": {
4647
"@types/node": "^20.0.0",
47-
"c8": "^7.0.0",
48-
"mdast-util-from-markdown": "^1.0.0",
49-
"micromark-extension-gfm-strikethrough": "^1.0.0",
48+
"c8": "^8.0.0",
49+
"micromark-extension-gfm-strikethrough": "^2.0.0",
5050
"prettier": "^2.0.0",
5151
"remark-cli": "^11.0.0",
5252
"remark-preset-wooorm": "^9.0.0",
5353
"type-coverage": "^2.0.0",
5454
"typescript": "^5.0.0",
55-
"unist-util-remove-position": "^4.0.0",
55+
"unist-util-remove-position": "^5.0.0",
5656
"xo": "^0.54.0"
5757
},
5858
"scripts": {

test.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ test('gfmStrikethroughFromMarkdown', () => {
1717
'should expose the public api'
1818
)
1919

20+
const tree = fromMarkdown('a ~~b~~ c.', {
21+
extensions: [gfmStrikethrough()],
22+
mdastExtensions: [gfmStrikethroughFromMarkdown]
23+
})
24+
25+
removePosition(tree, {force: true})
26+
2027
assert.deepEqual(
21-
removePosition(
22-
fromMarkdown('a ~~b~~ c.', {
23-
extensions: [gfmStrikethrough()],
24-
mdastExtensions: [gfmStrikethroughFromMarkdown]
25-
}),
26-
true
27-
),
28+
tree,
2829
{
2930
type: 'root',
3031
children: [
@@ -41,14 +42,15 @@ test('gfmStrikethroughFromMarkdown', () => {
4142
'should support strikethrough'
4243
)
4344

45+
const treeB = fromMarkdown('a ~~b\nc~~ d.', {
46+
extensions: [gfmStrikethrough()],
47+
mdastExtensions: [gfmStrikethroughFromMarkdown]
48+
})
49+
50+
removePosition(treeB, {force: true})
51+
4452
assert.deepEqual(
45-
removePosition(
46-
fromMarkdown('a ~~b\nc~~ d.', {
47-
extensions: [gfmStrikethrough()],
48-
mdastExtensions: [gfmStrikethroughFromMarkdown]
49-
}),
50-
true
51-
),
53+
treeB,
5254
{
5355
type: 'root',
5456
children: [

0 commit comments

Comments
 (0)