1
- # hast-util-raw [ ![ Build ] [ build-badge ]] [ build ] [ ![ Coverage ] [ coverage-badge ]] [ coverage ] [ ![ Downloads ] [ downloads-badge ]] [ downloads ] [ ![ Chat ] [ chat-badge ]] [ chat ]
1
+ # hast-util-raw
2
2
3
- Parse a [ hast] [ ] tree again, with support for embedded ` raw ` nodes.
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 ]
4
10
5
- One of the reasons to do this is for “malformed” syntax trees: for
6
- example, say there’s an ` h1 ` element in a ` p ` element, this utility
7
- will make them siblings.
11
+ [ ** hast** ] [ hast ] utility to parse the [ * tree* ] [ tree ] again, now supporting
12
+ embedded ` raw ` nodes.
8
13
9
- Another reason to do this is if raw HTML/XML is embedded in a syntax
10
- tree, such as markdown. If you’re working with markdown, use
11
- [ ` remark-rehype ` ] [ remark-rehype ] and [ ` rehype-raw ` ] [ rehype-raw ] .
14
+ One of the reasons to do this is for “malformed” syntax trees: for example, say
15
+ there’s an ` h1 ` element in a ` p ` element, this utility will make them siblings.
12
16
13
- ## Installation
17
+ Another reason to do this is if raw HTML/XML is embedded in a syntax tree, which
18
+ can occur when coming from Markdown using [ ` mdast-util-to-hast ` ] [ to-hast ] .
19
+
20
+ If you’re working with [ ** remark** ] [ remark ] and/or
21
+ [ ` remark-rehype ` ] [ remark-rehype ] , use [ ` rehype-raw ` ] [ rehype-raw ] instead.
22
+
23
+ ## Install
14
24
15
25
[ npm] [ ] :
16
26
17
- ``` bash
27
+ ``` sh
18
28
npm install hast-util-raw
19
29
```
20
30
21
31
## Usage
22
32
23
- ``` javascript
33
+ ``` js
24
34
var h = require (' hastscript' )
25
35
var raw = require (' hast-util-raw' )
26
36
@@ -53,16 +63,19 @@ Yields:
53
63
54
64
### ` raw(tree[, file]) `
55
65
56
- Given a [ hast] [ ] tree and an optional [ vfile] [ ] (for positional info),
57
- return a new parsed-again [ hast] [ ] tree.
66
+ Given a [ ** hast** ] [ hast ] [ * tree* ] [ tree ] and an optional [ vfile] [ ] (for
67
+ [ positional info] [ position-information ] ), return a new parsed-again
68
+ [ ** hast** ] [ hast ] [ * tree* ] [ tree ] .
58
69
59
70
## Contribute
60
71
61
- See [ ` contributing.md ` in ` syntax-tree/hast ` ] [ contributing ] for ways to get
72
+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
62
73
started.
74
+ See [ ` support.md ` ] [ support ] for ways to get help.
63
75
64
- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
65
- repository, organisation, or community you agree to abide by its terms.
76
+ This project has a [ Code of Conduct] [ coc ] .
77
+ By interacting with this repository, organisation, or community you agree to
78
+ abide by its terms.
66
79
67
80
## License
68
81
@@ -82,24 +95,44 @@ repository, organisation, or community you agree to abide by its terms.
82
95
83
96
[ downloads ] : https://www.npmjs.com/package/hast-util-raw
84
97
98
+ [ size-badge ] : https://img.shields.io/bundlephobia/minzip/hast-util-raw.svg
99
+
100
+ [ size ] : https://bundlephobia.com/result?p=hast-util-raw
101
+
102
+ [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
103
+
104
+ [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
105
+
106
+ [ collective ] : https://opencollective.com/unified
107
+
85
108
[ chat-badge ] : https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
86
109
87
- [ chat ] : https://spectrum.chat/unified/rehype
110
+ [ chat ] : https://spectrum.chat/unified/syntax-tree
88
111
89
112
[ npm ] : https://docs.npmjs.com/cli/install
90
113
91
114
[ license ] : license
92
115
93
116
[ author ] : https://wooorm.com
94
117
95
- [ hast ] : https://github.com/syntax-tree/hast
118
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/master/contributing.md
119
+
120
+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
96
121
97
- [ remark-rehype ] : https://github.com/wooorm/remark-rehype
122
+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
98
123
99
- [ rehype-raw ] : https://github.com/wooorm/rehype-raw
124
+ [ tree ] : https://github.com/syntax-tree/unist#tree
125
+
126
+ [ position-information ] : https://github.com/syntax-tree/unist#positional-information
127
+
128
+ [ hast ] : https://github.com/syntax-tree/hast
129
+
130
+ [ to-hast ] : https://github.com/syntax-tree/mdast-util-to-hast
100
131
101
132
[ vfile ] : https://github.com/vfile/vfile
102
133
103
- [ contributing ] : https://github.com/syntax-tree/hast/blob/master/contributing.md
134
+ [ remark ] : https://github.com/remarkjs/remark
135
+
136
+ [ remark-rehype ] : https://github.com/remarkjs/remark-rehype
104
137
105
- [ coc ] : https://github.com/syntax-tree/hast/blob/master/code-of-conduct.md
138
+ [ rehype-raw ] : https://github.com/rehypejs/rehype-raw
0 commit comments