1- # hast-util-raw [ ![ Build ] [ build-badge ]] [ build ] [ ![ Coverage ] [ coverage-badge ]] [ coverage ] [ ![ Downloads ] [ downloads-badge ]] [ downloads ] [ ![ Chat ] [ chat-badge ]] [ chat ]
1+ # hast-util-raw
22
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 ]
410
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.
813
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.
1216
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
1424
1525[ npm] [ ] :
1626
17- ``` bash
27+ ``` sh
1828npm install hast-util-raw
1929```
2030
2131## Usage
2232
23- ``` javascript
33+ ``` js
2434var h = require (' hastscript' )
2535var raw = require (' hast-util-raw' )
2636
@@ -53,16 +63,19 @@ Yields:
5363
5464### ` raw(tree[, file]) `
5565
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 ] .
5869
5970## Contribute
6071
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
6273started.
74+ See [ ` support.md ` ] [ support ] for ways to get help.
6375
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.
6679
6780## License
6881
@@ -82,24 +95,44 @@ repository, organisation, or community you agree to abide by its terms.
8295
8396[ downloads ] : https://www.npmjs.com/package/hast-util-raw
8497
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+
85108[ chat-badge ] : https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
86109
87- [ chat ] : https://spectrum.chat/unified/rehype
110+ [ chat ] : https://spectrum.chat/unified/syntax-tree
88111
89112[ npm ] : https://docs.npmjs.com/cli/install
90113
91114[ license ] : license
92115
93116[ author ] : https://wooorm.com
94117
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
96121
97- [ remark-rehype ] : https://github.com/wooorm/remark-rehype
122+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
98123
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
100131
101132[ vfile ] : https://github.com/vfile/vfile
102133
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
104137
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