Skip to content

Commit f3b96f4

Browse files
committed
Refactor docs
1 parent e74e68a commit f3b96f4

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

readme.md

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ internals away.
6262
## Install
6363

6464
This package is [ESM only][esm].
65-
In Node.js (version 14.14+ and 16.0+), install with [npm][]:
65+
In Node.js (version 16+), install with [npm][]:
6666

6767
```sh
6868
npm install mdast-util-mdx-expression
@@ -99,10 +99,10 @@ b {true}.
9999
```js
100100
import fs from 'node:fs/promises'
101101
import * as acorn from 'acorn'
102-
import {fromMarkdown} from 'mdast-util-from-markdown'
103-
import {toMarkdown} from 'mdast-util-to-markdown'
104102
import {mdxExpression} from 'micromark-extension-mdx-expression'
103+
import {fromMarkdown} from 'mdast-util-from-markdown'
105104
import {mdxExpressionFromMarkdown, mdxExpressionToMarkdown} from 'mdast-util-mdx-expression'
105+
import {toMarkdown} from 'mdast-util-to-markdown'
106106

107107
const doc = await fs.readFile('example.mdx')
108108

@@ -208,11 +208,15 @@ MDX expression node, occurring in flow (block) (TypeScript type).
208208

209209
```ts
210210
import type {Program} from 'estree-jsx'
211-
import type {Literal} from 'mdast'
211+
import type {Data, Literal} from 'mdast'
212212

213213
interface MdxFlowExpression extends Literal {
214214
type: 'mdxFlowExpression'
215-
data?: {estree?: Program | null | undefined} & Literal['data']
215+
data?: MdxFlowExpressionData | undefined
216+
}
217+
218+
interface MdxFlowExpressionData extends Data {
219+
estree?: Program | null | undefined
216220
}
217221
```
218222

@@ -224,11 +228,15 @@ MDX expression node, occurring in text (block) (TypeScript type).
224228

225229
```ts
226230
import type {Program} from 'estree-jsx'
227-
import type {Literal} from 'mdast'
231+
import type {Data, Literal} from 'mdast'
228232

229233
interface MdxTextExpression extends Literal {
230234
type: 'mdxTextExpression'
231-
data?: {estree?: Program | null | undefined} & Literal['data']
235+
data?: MdxTextExpressionData | undefined
236+
}
237+
238+
interface MdxTextExpressionData extends Data {
239+
estree?: Program | null | undefined
232240
}
233241
```
234242

@@ -241,11 +249,15 @@ Same as [`MdxFlowExpression`][api-mdx-flow-expression], but registered with
241249

242250
```ts
243251
import type {Program} from 'estree-jsx'
244-
import type {Literal} from 'hast'
252+
import type {Data, Literal} from 'hast'
245253

246254
interface MdxFlowExpressionHast extends Literal {
247255
type: 'mdxFlowExpression'
248-
data?: {estree?: Program | null | undefined} & Literal['data']
256+
data?: MdxFlowExpressionData | undefined
257+
}
258+
259+
interface MdxFlowExpressionData extends Data {
260+
estree?: Program | null | undefined
249261
}
250262
```
251263

@@ -258,11 +270,15 @@ Same as [`MdxTextExpression`][api-mdx-text-expression], but registered with
258270

259271
```ts
260272
import type {Program} from 'estree-jsx'
261-
import type {Literal} from 'hast'
273+
import type {Data, Literal} from 'hast'
262274

263275
interface MdxTextExpressionHast extends Literal {
264276
type: 'mdxTextExpression'
265-
data?: {estree?: Program | null | undefined} & Literal['data']
277+
data?: MdxTextExpressionData | undefined
278+
}
279+
280+
interface MdxTextExpressionData extends Data {
281+
estree?: Program | null | undefined
266282
}
267283
```
268284

@@ -288,7 +304,7 @@ The following interfaces are added to **[mdast][]** by this utility.
288304

289305
```idl
290306
interface MdxFlowExpression <: Literal {
291-
type: "mdxFlowExpression"
307+
type: 'mdxFlowExpression'
292308
}
293309
```
294310

@@ -315,7 +331,7 @@ Yields:
315331

316332
```idl
317333
interface MdxTextExpression <: Literal {
318-
type: "mdxTextExpression"
334+
type: 'mdxTextExpression"
319335
}
320336
```
321337

@@ -379,12 +395,15 @@ visit(tree, function (node) {
379395

380396
## Compatibility
381397

382-
Projects maintained by the unified collective are compatible with all maintained
398+
Projects maintained by the unified collective are compatible with maintained
383399
versions of Node.js.
384-
As of now, that is Node.js 14.14+ and 16.0+.
385-
Our projects sometimes work with older versions, but this is not guaranteed.
386400

387-
This plugin works with `mdast-util-from-markdown` version 1+ and
401+
When we cut a new major release, we drop support for unmaintained versions of
402+
Node.
403+
This means we try to keep the current release line,
404+
`mdast-util-mdx-expression@^1`, compatible with Node.js 12.
405+
406+
This utility works with `mdast-util-from-markdown` version 1+ and
388407
`mdast-util-to-markdown` version 1+.
389408

390409
## Related
@@ -424,9 +443,9 @@ abide by its terms.
424443

425444
[downloads]: https://www.npmjs.com/package/mdast-util-mdx-expression
426445

427-
[size-badge]: https://img.shields.io/bundlephobia/minzip/mdast-util-mdx-expression.svg
446+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-mdx-expression
428447

429-
[size]: https://bundlephobia.com/result?p=mdast-util-mdx-expression
448+
[size]: https://bundlejs.com/?q=mdast-util-mdx-expression
430449

431450
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
432451

0 commit comments

Comments
 (0)