11# hast-util-raw
22
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 ]
3+ [ ![ Build] [ badge-build-image ]] [ badge-build-url ]
4+ [ ![ Coverage] [ badge-coverage-image ]] [ badge-coverage-url ]
5+ [ ![ Downloads] [ badge-downloads-image ]] [ badge-downloads-url ]
6+ [ ![ Size] [ badge-size-image ]] [ badge-size-url ]
107
11- [ hast] [ ] utility to parse the tree and semistandard ` raw ` nodes (strings of
12- HTML) again, keeping positional info okay.
8+ [ hast] [ github-hast ] utility to parse the tree and semistandard ` raw ` nodes
9+ (strings of HTML) again, keeping positional info okay.
1310
1411## Contents
1512
@@ -31,14 +28,15 @@ HTML) again, keeping positional info okay.
3128
3229This package is a utility to parse a document again.
3330It passes each node and embedded raw HTML through an HTML parser
34- ([ ` parse5 ` ] [ parse5 ] ), to recreate a tree exactly as how a browser would parse
35- it, while keeping the original data and positional info intact.
31+ ([ ` parse5 ` ] [ github- parse5] ), to recreate a tree exactly as how a browser would
32+ parse it, while keeping the original data and positional info intact.
3633
3734## When should I use this?
3835
3936This utility is particularly useful when coming from markdown and wanting to
4037support HTML embedded inside that markdown (which requires passing
41- ` allowDangerousHtml: true ` to [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] ).
38+ ` allowDangerousHtml: true ` to
39+ [ ` mdast-util-to-hast ` ] [ github-mdast-util-to-hast ] ).
4240Markdown dictates how, say, a list item or emphasis can be parsed.
4341We can use that to turn the markdown syntax tree into an HTML syntax tree.
4442But markdown also dictates that things that look like HTML, are passed through
@@ -58,13 +56,13 @@ But there are two main cases where a proper syntax tree is preferred:
5856* other output formats (React, MDX, etc) need actual nodes and can’t handle
5957 strings of HTML
6058
61- The plugin [ ` rehype-raw ` ] [ rehype-raw ] wraps this utility at a higher-level
62- (easier) abstraction.
59+ The plugin [ ` rehype-raw ` ] [ github- rehype-raw] wraps this utility at a
60+ higher-level (easier) abstraction.
6361
6462## Install
6563
66- This package is [ ESM only] [ esm ] .
67- In Node.js (version 16+), install with [ npm] [ ] :
64+ This package is [ ESM only] [ github-gist- esm] .
65+ In Node.js (version 16+), install with [ npm] [ npmjs-install ] :
6866
6967``` sh
7068npm install hast-util-raw
@@ -172,7 +170,7 @@ This package is fully typed with [TypeScript][].
172170It exports the additional type [ ` Options ` ] [ api-options ] .
173171
174172The ` Raw ` node type is registered by and exposed from
175- [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ] .
173+ [ ` mdast-util-to-hast ` ] [ github- mdast-util-to-hast] .
176174
177175## Compatibility
178176
@@ -186,7 +184,8 @@ compatible with Node.js 16.
186184
187185## Security
188186
189- Use of ` hast-util-raw ` can open you up to a [ cross-site scripting (XSS)] [ xss ]
187+ Use of ` hast-util-raw ` can open you up to a
188+ [ cross-site scripting (XSS)] [ wikipedia-xss ]
190189attack as ` raw ` nodes are unsafe.
191190The following example shows how a raw node is used to inject a script that runs
192191when loaded in a browser.
@@ -202,87 +201,77 @@ Yields:
202201```
203202
204203Either do not use this utility in combination with user input, or use
205- [ ` hast-util-santize ` ] [ hast-util-sanitize ] .
204+ [ ` hast-util-santize ` ] [ github- hast-util-sanitize] .
206205
207206## Related
208207
209- * [ ` mdast-util-to-hast ` ] [ mdast-util-to-hast ]
208+ * [ ` mdast-util-to-hast ` ] [ github- mdast-util-to-hast]
210209 — transform mdast to hast
211- * [ ` rehype-raw ` ] ( https:// github.com/rehypejs/ rehype-raw)
210+ * [ ` rehype-raw ` ] [ github- rehype-raw ]
212211 — rehype plugin
213212
214213## Contribute
215214
216- See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
217- ways to get started.
218- See [ ` support.md ` ] [ support ] for ways to get help.
215+ See [ ` contributing.md ` ] [ health- contributing] in [ ` syntax-tree/.github ` ] [ health ]
216+ for ways to get started.
217+ See [ ` support.md ` ] [ health- support] for ways to get help.
219218
220- This project has a [ code of conduct] [ coc ] .
219+ This project has a [ code of conduct] [ health- coc] .
221220By interacting with this repository, organization, or community you agree to
222221abide by its terms.
223222
224223## License
225224
226- [ MIT] [ license ] © [ Titus Wormer] [ author ]
225+ [ MIT] [ file- license] © [ Titus Wormer] [ wooorm ]
227226
228227<!-- Definitions -->
229228
230- [ build-badge ] : https://github.com/syntax-tree/hast-util-raw/workflows/main/badge.svg
231-
232- [ build ] : https://github.com/syntax-tree/hast-util-raw/actions
233-
234- [ coverage-badge ] : https://img.shields.io/codecov/c/github/syntax-tree/hast-util-raw.svg
229+ [ api-options ] : #options
235230
236- [ coverage ] : https://codecov.io/github/ syntax-tree/hast-util-raw
231+ [ badge-build-image ] : https://github.com/ syntax-tree/hast-util-raw/workflows/main/badge.svg
237232
238- [ downloads- badge] : https://img.shields.io/npm/dm/ hast-util-raw.svg
233+ [ badge-build-url ] : https://github.com/syntax-tree/ hast-util-raw/actions
239234
240- [ downloads ] : https://www.npmjs.com/package/ hast-util-raw
235+ [ badge-coverage-image ] : https://img.shields.io/codecov/c/github/syntax-tree/ hast-util-raw.svg
241236
242- [ size- badge] : https://img.shields. io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q= hast-util-raw
237+ [ badge-coverage-url ] : https://codecov. io/github/syntax-tree/ hast-util-raw
243238
244- [ size ] : https://bundlejs.com/?q= hast-util-raw
239+ [ badge-downloads-image ] : https://img.shields.io/npm/dm/ hast-util-raw.svg
245240
246- [ sponsors- badge] : https://opencollective. com/unified/sponsors/badge.svg
241+ [ badge-downloads-url ] : https://www.npmjs. com/package/hast-util-raw
247242
248- [ backers- badge] : https://opencollective.com/unified/backers/badge.svg
243+ [ badge-size-image ] : https://img.shields.io/bundlejs/size/hast-util-raw
249244
250- [ collective ] : https://opencollective .com/unified
245+ [ badge-size-url ] : https://bundlejs .com/?q=hast-util-raw
251246
252- [ chat-badge ] : https://img.shields.io/badge/chat-discussions-success.svg
247+ [ esmsh ] : https://esm.sh
253248
254- [ chat ] : https://github.com/syntax-tree/unist/discussions
249+ [ file-license ] : license
255250
256- [ npm ] : https://docs.npmjs .com/cli/install
251+ [ github-gist-esm ] : https://gist.github .com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
257252
258- [ esm ] : https://gist. github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
253+ [ github-hast ] : https://github.com/syntax-tree/hast
259254
260- [ esmsh ] : https://esm.sh
255+ [ github-hast-util-sanitize ] : https://github.com/syntax-tree/hast-util-sanitize
261256
262- [ typescript ] : https://www.typescriptlang.org
257+ [ github-mdast-util-to-hast ] : https://github.com/syntax-tree/mdast-util-to-hast
263258
264- [ license ] : license
259+ [ github-parse5 ] : https://github.com/inikulin/parse5
265260
266- [ author ] : https://wooorm .com
261+ [ github-rehype-raw ] : https://github .com/rehypejs/rehype-raw
267262
268263[ health ] : https://github.com/syntax-tree/.github
269264
270- [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
265+ [ health-coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct .md
271266
272- [ support ] : https://github.com/syntax-tree/.github/blob/main/support .md
267+ [ health-contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
273268
274- [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct .md
269+ [ health-support ] : https://github.com/syntax-tree/.github/blob/main/support .md
275270
276- [ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
271+ [ npmjs-install ] : https://docs.npmjs.com/cli/install
277272
278- [ hast ] : https://github.com/syntax-tree/hast
279-
280- [ mdast-util-to-hast ] : https://github.com/syntax-tree/mdast-util-to-hast
281-
282- [ hast-util-sanitize ] : https://github.com/syntax-tree/hast-util-sanitize
283-
284- [ rehype-raw ] : https://github.com/rehypejs/rehype-raw
273+ [ typescript ] : https://www.typescriptlang.org
285274
286- [ parse5 ] : https://github.com/inikulin/parse5
275+ [ wikipedia-xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
287276
288- [ api-options ] : #options
277+ [ wooorm ] : https://wooorm.com
0 commit comments