19
19
* [ API] ( #api )
20
20
* [ ` gfmStrikethroughFromMarkdown ` ] ( #gfmstrikethroughfrommarkdown )
21
21
* [ ` gfmStrikethroughToMarkdown ` ] ( #gfmstrikethroughtomarkdown )
22
+ * [ HTML] ( #html )
23
+ * [ Syntax] ( #syntax )
22
24
* [ Syntax tree] ( #syntax-tree )
23
25
* [ Nodes] ( #nodes )
24
26
* [ Content model] ( #content-model )
30
32
31
33
## What is this?
32
34
33
- This package contains extensions that add support for the strikethrough syntax
34
- enabled by GFM to [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] and
35
- [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
35
+ This package contains two extensions that add support for GFM strikethrough
36
+ syntax in markdown to [ mdast] [ ] .
37
+ These extensions plug into
38
+ [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] (to support parsing
39
+ strikethrough in markdown into a syntax tree) and
40
+ [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] (to support serializing
41
+ strikethrough in syntax trees to markdown).
36
42
37
43
## When to use this
38
44
39
- These tools are all rather low-level.
40
- In most cases, you’d want to use [ ` remark-gfm ` ] [ remark-gfm ] with remark instead.
45
+ You can use these extensions when you are working with
46
+ ` mdast-util-from-markdown ` and ` mdast-util-to-markdown ` already.
47
+
48
+ When working with ` mdast-util-from-markdown ` , you must combine this package
49
+ with [ ` micromark-extension-gfm-strikethrough ` ] [ extension ] .
50
+
51
+ When you don’t need a syntax tree, you can use [ ` micromark ` ] [ micromark ]
52
+ directly with ` micromark-extension-gfm-strikethrough ` .
41
53
42
54
When you are working with syntax trees and want all of GFM, use
43
55
[ ` mdast-util-gfm ` ] [ mdast-util-gfm ] instead.
44
56
45
- When working with ` mdast-util-from-markdown ` , you must combine this package with
46
- [ ` micromark-extension-gfm-strikethrough ` ] [ extension ] .
57
+ All these packages are used [ ` remark-gfm ` ] [ remark-gfm ] , which
58
+ focusses on making it easier to transform content by abstracting these
59
+ internals away.
47
60
48
61
This utility does not handle how markdown is turned to HTML.
49
62
That’s done by [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
@@ -52,7 +65,7 @@ If you want a different element, you should configure that utility.
52
65
## Install
53
66
54
67
This package is [ ESM only] [ esm ] .
55
- In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm] [ ] :
68
+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
56
69
57
70
``` sh
58
71
npm install mdast-util-gfm-strikethrough
@@ -130,17 +143,30 @@ Now, running `node example` yields:
130
143
131
144
## API
132
145
133
- This package exports the identifiers ` gfmStrikethroughFromMarkdown ` and
134
- ` gfmStrikethroughToMarkdown ` .
146
+ This package exports the identifiers
147
+ [ ` gfmStrikethroughFromMarkdown ` ] [ api-gfm-strikethrough-from-markdown ] and
148
+ [ ` gfmStrikethroughToMarkdown ` ] [ api-gfm-strikethrough-to-markdown ] .
135
149
There is no default export.
136
150
137
151
### ` gfmStrikethroughFromMarkdown `
138
152
139
- Extension for [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] .
153
+ Extension for [ ` mdast-util-from-markdown ` ] [ mdast-util-from-markdown ] to enable
154
+ GFM strikethrough ([ ` FromMarkdownExtension ` ] [ from-markdown-extension ] ).
140
155
141
156
### ` gfmStrikethroughToMarkdown `
142
157
143
- Extension for [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] .
158
+ Extension for [ ` mdast-util-to-markdown ` ] [ mdast-util-to-markdown ] to enable
159
+ GFM strikethrough ([ ` ToMarkdownExtension ` ] [ to-markdown-extension ] ).
160
+
161
+ ## HTML
162
+
163
+ This utility does not handle how markdown is turned to HTML.
164
+ That’s done by [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
165
+ If you want a different element, you should configure that utility.
166
+
167
+ ## Syntax
168
+
169
+ See [ Syntax in ` micromark-extension-gfm-strikethrough ` ] [ syntax ] .
144
170
145
171
## Syntax tree
146
172
@@ -152,17 +178,17 @@ The following interfaces are added to **[mdast][]** by this utility.
152
178
153
179
``` idl
154
180
interface Delete <: Parent {
155
- type: " delete"
181
+ type: ' delete'
156
182
children: [TransparentContent]
157
183
}
158
184
```
159
185
160
- ** Delete** ([ ** Parent** ] [ dfn-parent ] ) represents contents that are no longer
186
+ ** Delete** (** [ Parent] [ dfn-parent ] ** ) represents contents that are no longer
161
187
accurate or no longer relevant.
162
188
163
- ** Delete** can be used where [ ** static phrasing** ] [ dfn-static-phrasing-content ]
189
+ ** Delete** can be used where ** [ static phrasing] [ dfn-static-phrasing-content ] **
164
190
content is expected.
165
- Its content model is [ ** transparent** ] [ dfn-transparent-content ] content.
191
+ Its content model is ** [ transparent] [ dfn-transparent-content ] ** content.
166
192
167
193
For example, the following markdown:
168
194
@@ -192,13 +218,13 @@ type StaticPhrasingContentGfm = Delete | StaticPhrasingContent
192
218
This package is fully typed with [ TypeScript] [ ] .
193
219
It does not export additional types.
194
220
195
- The ` Delete ` node type is supported in ` @types/mdast ` by default .
221
+ The ` Delete ` type of the mdast node is exposed from ` @types/mdast ` .
196
222
197
223
## Compatibility
198
224
199
225
Projects maintained by the unified collective are compatible with all maintained
200
226
versions of Node.js.
201
- As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
227
+ As of now, that is Node.js 14.14+ and 16.0+.
202
228
Our projects sometimes work with older versions, but this is not guaranteed.
203
229
204
230
This plugin works with ` mdast-util-from-markdown ` version 1+ and
@@ -286,14 +312,26 @@ abide by its terms.
286
312
287
313
[ mdast-util-from-markdown ] : https://github.com/syntax-tree/mdast-util-from-markdown
288
314
315
+ [ from-markdown-extension ] : https://github.com/syntax-tree/mdast-util-from-markdown#extension
316
+
289
317
[ mdast-util-to-markdown ] : https://github.com/syntax-tree/mdast-util-to-markdown
290
318
319
+ [ to-markdown-extension ] : https://github.com/syntax-tree/mdast-util-to-markdown#options
320
+
291
321
[ mdast-util-gfm ] : https://github.com/syntax-tree/mdast-util-gfm
292
322
293
323
[ mdast-util-to-hast ] : https://github.com/syntax-tree/mdast-util-to-hast
294
324
325
+ [ micromark ] : https://github.com/micromark/micromark
326
+
295
327
[ extension ] : https://github.com/micromark/micromark-extension-gfm-strikethrough
296
328
329
+ [ syntax ] : https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax
330
+
297
331
[ dfn-parent ] : https://github.com/syntax-tree/mdast#parent
298
332
299
333
[ dfn-static-phrasing-content ] : #staticphrasingcontent-gfm-strikethrough
334
+
335
+ [ api-gfm-strikethrough-from-markdown ] : #gfmstrikethroughfrommarkdown
336
+
337
+ [ api-gfm-strikethrough-to-markdown ] : #gfmstrikethroughtomarkdown
0 commit comments