File tree Expand file tree Collapse file tree 3 files changed +24
-25
lines changed Expand file tree Collapse file tree 3 files changed +24
-25
lines changed Original file line number Diff line number Diff line change 10
10
* @typedef {import('mdast-util-to-markdown').Handle } ToMarkdownHandle
11
11
*/
12
12
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
-
16
13
// To do: next major: expose functions.
17
14
// To do: next major: use `state`, state utilities.
18
15
@@ -85,10 +82,10 @@ function exitStrikethrough(token) {
85
82
* @param {Delete } node
86
83
*/
87
84
function handleDelete ( node , _ , context , safeOptions ) {
88
- const tracker = track ( safeOptions )
85
+ const tracker = context . createTracker ( safeOptions )
89
86
const exit = context . enter ( 'strikethrough' )
90
87
let value = tracker . move ( '~~' )
91
- value += containerPhrasing ( node , context , {
88
+ value += context . containerPhrasing ( node , {
92
89
...tracker . current ( ) ,
93
90
before : value ,
94
91
after : '~'
Original file line number Diff line number Diff line change 39
39
" index.js"
40
40
],
41
41
"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"
44
45
},
45
46
"devDependencies" : {
46
47
"@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" ,
50
50
"prettier" : " ^2.0.0" ,
51
51
"remark-cli" : " ^11.0.0" ,
52
52
"remark-preset-wooorm" : " ^9.0.0" ,
53
53
"type-coverage" : " ^2.0.0" ,
54
54
"typescript" : " ^5.0.0" ,
55
- "unist-util-remove-position" : " ^4 .0.0" ,
55
+ "unist-util-remove-position" : " ^5 .0.0" ,
56
56
"xo" : " ^0.54.0"
57
57
},
58
58
"scripts" : {
Original file line number Diff line number Diff line change @@ -17,14 +17,15 @@ test('gfmStrikethroughFromMarkdown', () => {
17
17
'should expose the public api'
18
18
)
19
19
20
+ const tree = fromMarkdown ( 'a ~~b~~ c.' , {
21
+ extensions : [ gfmStrikethrough ( ) ] ,
22
+ mdastExtensions : [ gfmStrikethroughFromMarkdown ]
23
+ } )
24
+
25
+ removePosition ( tree , { force : true } )
26
+
20
27
assert . deepEqual (
21
- removePosition (
22
- fromMarkdown ( 'a ~~b~~ c.' , {
23
- extensions : [ gfmStrikethrough ( ) ] ,
24
- mdastExtensions : [ gfmStrikethroughFromMarkdown ]
25
- } ) ,
26
- true
27
- ) ,
28
+ tree ,
28
29
{
29
30
type : 'root' ,
30
31
children : [
@@ -41,14 +42,15 @@ test('gfmStrikethroughFromMarkdown', () => {
41
42
'should support strikethrough'
42
43
)
43
44
45
+ const treeB = fromMarkdown ( 'a ~~b\nc~~ d.' , {
46
+ extensions : [ gfmStrikethrough ( ) ] ,
47
+ mdastExtensions : [ gfmStrikethroughFromMarkdown ]
48
+ } )
49
+
50
+ removePosition ( treeB , { force : true } )
51
+
44
52
assert . deepEqual (
45
- removePosition (
46
- fromMarkdown ( 'a ~~b\nc~~ d.' , {
47
- extensions : [ gfmStrikethrough ( ) ] ,
48
- mdastExtensions : [ gfmStrikethroughFromMarkdown ]
49
- } ) ,
50
- true
51
- ) ,
53
+ treeB ,
52
54
{
53
55
type : 'root' ,
54
56
children : [
You can’t perform that action at this time.
0 commit comments