Skip to content

Commit f79dc02

Browse files
committed
Refactor prose
1 parent cbf413b commit f79dc02

File tree

3 files changed

+1646
-30
lines changed

3 files changed

+1646
-30
lines changed

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@
3838
"eslint-plugin-import": "^2.0.0",
3939
"glob": "^7.0.0",
4040
"jest-cli": "^24.0.0",
41+
"remark-cli": "^6.0.1",
42+
"remark-preset-wooorm": "^5.0.0",
4143
"rollup": "^1.0.0",
4244
"rollup-plugin-babel": "^4.0.1"
4345
},
4446
"scripts": {
4547
"build": "rollup -c",
46-
"lint": "eslint .",
48+
"lint": "remark . -qfo && eslint .",
4749
"test": "jest",
4850
"test:dev": "jest --watchAll"
4951
},
@@ -60,5 +62,10 @@
6062
"statements": 100
6163
}
6264
}
65+
},
66+
"remarkConfig": {
67+
"plugins": [
68+
"preset-wooorm"
69+
]
6370
}
6471
}

readme.md

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
# hast-util-from-dom [![Build Status][travis-badge]][travis]
1+
# hast-util-from-dom
22

3-
Transform a DOM tree to [HAST][]
3+
[![Build][build-badge]][build]
4+
[![Coverage][coverage-badge]][coverage]
5+
[![Downloads][downloads-badge]][downloads]
6+
[![Size][size-badge]][size]
7+
[![Sponsors][sponsors-badge]][collective]
8+
[![Backers][backers-badge]][collective]
9+
[![Chat][chat-badge]][chat]
410

5-
## Installation
11+
[**hast**][hast] utility to transform from a DOM tree.
12+
13+
## Install
614

715
[yarn][]:
816

9-
```bash
17+
```sh
1018
yarn add hast-util-from-dom
1119
```
1220

1321
[npm][]:
1422

15-
```bash
23+
```sh
1624
npm install hast-util-from-dom
1725
```
1826

1927
## Usage
2028

21-
This utility is similar to [`hast-util-from-parse5`][hast-util-from-parse5], but is intended for browser use and therefore relies on the native DOM API instead of an external parsing library.
29+
This utility is similar to [`hast-util-from-parse5`][hast-util-from-parse5], but
30+
is intended for browser use and therefore relies on the native DOM API instead
31+
of an external parsing library.
2232

2333
Say we have the following file, `example.html`:
2434

@@ -32,7 +42,7 @@ Suppose `example.js` is a bundled version of something like this:
3242
import inspect from 'unist-util-inspect';
3343
import fromDOM from 'hast-util-from-dom';
3444

35-
const hast = fromDOM(document.documentElement.parentNode);
45+
const hast = fromDOM(document);
3646

3747
console.log(inspect.noColor(hast));
3848
```
@@ -57,27 +67,53 @@ root[2]
5767

5868
### `fromDOM(node)`
5969

60-
Transform a DOM `Node` to a [HAST Node][node].
70+
Transform a DOM tree to a [**hast**][hast] [*tree*][tree].
6171

62-
This works in a similar way to the `parse5` version except that it works directly from the DOM rather than a string of HTML. Consequently, it does not maintain location infomation.
72+
This works in a similar way to the [`parse5`][hast-util-from-parse5] version
73+
except that it works directly from the DOM rather than a string of HTML.
74+
Consequently, it does not maintain [positional info][positional-information].
6375

6476
## Contribute
6577

66-
See [`contributing.md` in `syntax-tree/hast`][contributing] for ways to get
78+
See [`contributing.md` in `syntax-tree/.github`][contributing] for ways to get
6779
started.
80+
See [`support.md`][support] for ways to get help.
6881

69-
This organisation has a [Code of Conduct][coc]. By interacting with this
70-
repository, organisation, or community you agree to abide by its terms.
82+
This project has a [Code of Conduct][coc].
83+
By interacting with this repository, organisation, or community you agree to
84+
abide by its terms.
7185

7286
## License
7387

7488
[ISC][license] © [Keith McKnight][author]
7589

7690
<!-- Definitions -->
7791

78-
[travis-badge]: https://img.shields.io/travis/syntax-tree/hast-util-from-dom.svg
92+
[build-badge]: https://img.shields.io/travis/syntax-tree/hast-util-from-dom.svg
93+
94+
[build]: https://travis-ci.org/syntax-tree/hast-util-from-dom
95+
96+
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-from-dom.svg
97+
98+
[coverage]: https://codecov.io/github/syntax-tree/hast-util-from-dom
99+
100+
[downloads-badge]: https://img.shields.io/npm/dm/hast-util-from-dom.svg
101+
102+
[downloads]: https://www.npmjs.com/package/hast-util-from-dom
103+
104+
[size-badge]: https://img.shields.io/bundlephobia/minzip/hast-util-from-dom.svg
105+
106+
[size]: https://bundlephobia.com/result?p=hast-util-from-dom
107+
108+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
79109

80-
[travis]: https://travis-ci.org/syntax-tree/hast-util-from-dom
110+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
111+
112+
[collective]: https://opencollective.com/unified
113+
114+
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
115+
116+
[chat]: https://spectrum.chat/unified/syntax-tree
81117

82118
[yarn]: https://yarnpkg.com/lang/en/docs/install
83119

@@ -87,12 +123,16 @@ repository, organisation, or community you agree to abide by its terms.
87123

88124
[author]: https://keith.mcknig.ht
89125

90-
[hast]: https://github.com/syntax-tree/hast
126+
[contributing]: https://github.com/syntax-tree/.github/blob/master/contributing.md
91127

92-
[hast-util-from-parse5]: https://github.com/syntax-tree/hast-util-from-parse5
128+
[support]: https://github.com/syntax-tree/.github/blob/master/support.md
93129

94-
[node]: https://github.com/syntax-tree/hast#ast
130+
[coc]: https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
95131

96-
[contributing]: https://github.com/syntax-tree/hast/blob/master/contributing.md
132+
[tree]: https://github.com/syntax-tree/unist#tree
97133

98-
[coc]: https://github.com/syntax-tree/hast/blob/master/code-of-conduct.md
134+
[positional-information]: https://github.com/syntax-tree/unist#positional-information
135+
136+
[hast]: https://github.com/syntax-tree/hast
137+
138+
[hast-util-from-parse5]: https://github.com/syntax-tree/hast-util-from-parse5

0 commit comments

Comments
 (0)