Skip to content

Commit

Permalink
Refactor docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 10, 2023
1 parent fd0a325 commit f70934a
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ That’s done by [`mdast-util-to-hast`][mdast-util-to-hast].
## Install

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

```sh
npm install mdast-util-gfm-table
Expand Down Expand Up @@ -103,15 +103,15 @@ Say our document `example.md` contains:

```js
import fs from 'node:fs/promises'
import {fromMarkdown} from 'mdast-util-from-markdown'
import {toMarkdown} from 'mdast-util-to-markdown'
import {gfmTable} from 'micromark-extension-gfm-table'
import {fromMarkdown} from 'mdast-util-from-markdown'
import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table'
import {toMarkdown} from 'mdast-util-to-markdown'

const doc = await fs.readFile('example.md')

const tree = fromMarkdown(doc, {
extensions: [gfmTable],
extensions: [gfmTable()],
mdastExtensions: [gfmTableFromMarkdown]
})

Expand Down Expand Up @@ -220,10 +220,10 @@ It’s possible to align tables based on the visual width of cells.
First, let’s show the problem:

```js
import {fromMarkdown} from 'mdast-util-from-markdown'
import {toMarkdown} from 'mdast-util-to-markdown'
import {gfmTable} from 'micromark-extension-gfm-table'
import {fromMarkdown} from 'mdast-util-from-markdown'
import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table'
import {toMarkdown} from 'mdast-util-to-markdown'

const doc = `| Alpha | Bravo |
| - | - |
Expand Down Expand Up @@ -254,16 +254,16 @@ One such algorithm is [`string-width`][string-width].
It can be used like so:

```diff
@@ -2,6 +2,7 @@ import {fromMarkdown} from 'mdast-util-from-markdown'
import {toMarkdown} from 'mdast-util-to-markdown'
import {gfmTable} from 'micromark-extension-gfm-table'
@@ -2,6 +2,7 @@ import {gfmTable} from 'micromark-extension-gfm-table'
import {fromMarkdown} from 'mdast-util-from-markdown'
import {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table'
import {toMarkdown} from 'mdast-util-to-markdown'
+import stringWidth from 'string-width'

const doc = `| Alpha | Bravo |
| - | - |
@@ -13,4 +14,8 @@ const tree = fromMarkdown(doc, {
mdastExtensions: [gfmTableFromMarkdown]
mdastExtensions: [gfmTableFromMarkdown()]
})

-console.log(toMarkdown(tree, {extensions: [gfmTableToMarkdown()]}))
Expand Down Expand Up @@ -409,7 +409,7 @@ For an example, see **[Table][dfn-table]**.

```idl
enum alignType {
"left" | "right" | "center" | null
'center' | 'left' | 'right' | null
}
```

Expand Down Expand Up @@ -458,12 +458,15 @@ from `@types/mdast`.

## Compatibility

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

This plugin works with `mdast-util-from-markdown` version 1+ and
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `mdast-util-gfm-table@^1`,
compatible with Node.js 12.

This utility works with `mdast-util-from-markdown` version 1+ and
`mdast-util-to-markdown` version 1+.

## Related
Expand Down Expand Up @@ -504,9 +507,9 @@ abide by its terms.

[downloads]: https://www.npmjs.com/package/mdast-util-gfm-table

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

[size]: https://bundlephobia.com/result?p=mdast-util-gfm-table
[size]: https://bundlejs.com/?q=mdast-util-gfm-table

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

Expand Down

0 comments on commit f70934a

Please sign in to comment.