Skip to content

Commit bf5e841

Browse files
committed
Add improved docs
1 parent 66783ae commit bf5e841

File tree

1 file changed

+56
-18
lines changed

1 file changed

+56
-18
lines changed

readme.md

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* [API](#api)
2020
* [`gfmStrikethroughFromMarkdown`](#gfmstrikethroughfrommarkdown)
2121
* [`gfmStrikethroughToMarkdown`](#gfmstrikethroughtomarkdown)
22+
* [HTML](#html)
23+
* [Syntax](#syntax)
2224
* [Syntax tree](#syntax-tree)
2325
* [Nodes](#nodes)
2426
* [Content model](#content-model)
@@ -30,20 +32,31 @@
3032

3133
## What is this?
3234

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).
3642

3743
## When to use this
3844

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`.
4153

4254
When you are working with syntax trees and want all of GFM, use
4355
[`mdast-util-gfm`][mdast-util-gfm] instead.
4456

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.
4760

4861
This utility does not handle how markdown is turned to HTML.
4962
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.
5265
## Install
5366

5467
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][]:
5669

5770
```sh
5871
npm install mdast-util-gfm-strikethrough
@@ -130,17 +143,30 @@ Now, running `node example` yields:
130143

131144
## API
132145

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].
135149
There is no default export.
136150

137151
### `gfmStrikethroughFromMarkdown`
138152

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]).
140155

141156
### `gfmStrikethroughToMarkdown`
142157

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].
144170

145171
## Syntax tree
146172

@@ -152,17 +178,17 @@ The following interfaces are added to **[mdast][]** by this utility.
152178

153179
```idl
154180
interface Delete <: Parent {
155-
type: "delete"
181+
type: 'delete'
156182
children: [TransparentContent]
157183
}
158184
```
159185

160-
**Delete** ([**Parent**][dfn-parent]) represents contents that are no longer
186+
**Delete** (**[Parent][dfn-parent]**) represents contents that are no longer
161187
accurate or no longer relevant.
162188

163-
**Delete** can be used where [**static phrasing**][dfn-static-phrasing-content]
189+
**Delete** can be used where **[static phrasing][dfn-static-phrasing-content]**
164190
content is expected.
165-
Its content model is [**transparent**][dfn-transparent-content] content.
191+
Its content model is **[transparent][dfn-transparent-content]** content.
166192

167193
For example, the following markdown:
168194

@@ -192,13 +218,13 @@ type StaticPhrasingContentGfm = Delete | StaticPhrasingContent
192218
This package is fully typed with [TypeScript][].
193219
It does not export additional types.
194220

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`.
196222

197223
## Compatibility
198224

199225
Projects maintained by the unified collective are compatible with all maintained
200226
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+.
202228
Our projects sometimes work with older versions, but this is not guaranteed.
203229

204230
This plugin works with `mdast-util-from-markdown` version 1+ and
@@ -286,14 +312,26 @@ abide by its terms.
286312

287313
[mdast-util-from-markdown]: https://github.com/syntax-tree/mdast-util-from-markdown
288314

315+
[from-markdown-extension]: https://github.com/syntax-tree/mdast-util-from-markdown#extension
316+
289317
[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown
290318

319+
[to-markdown-extension]: https://github.com/syntax-tree/mdast-util-to-markdown#options
320+
291321
[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
292322

293323
[mdast-util-to-hast]: https://github.com/syntax-tree/mdast-util-to-hast
294324

325+
[micromark]: https://github.com/micromark/micromark
326+
295327
[extension]: https://github.com/micromark/micromark-extension-gfm-strikethrough
296328

329+
[syntax]: https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax
330+
297331
[dfn-parent]: https://github.com/syntax-tree/mdast#parent
298332

299333
[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

Comments
 (0)